Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #8681 from gkhanna79/PNBBuildPkg
Browse files Browse the repository at this point in the history
Update build-packages.sh to support portableLinux
  • Loading branch information
wtgodbe authored Dec 19, 2016
2 parents 8891481 + 1c5dc53 commit 6694997
Showing 1 changed file with 62 additions and 4 deletions.
66 changes: 62 additions & 4 deletions build-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,56 @@
usage()
{
echo "Builds the NuGet packages from the binaries that were built in the Build product binaries step."
echo "Usage: build-packages -BuildArch -BuildType"
echo "arch can be x64, x86, arm, arm64 (default is x64)"
echo "configuration can be release, checked, debug (default is debug)"
echo "Usage: build-packages -BuildArch -BuildType [portableLinux]"
echo "BuildArch can be x64, x86, arm, arm64 (default is x64)"
echo "BuildType can be release, checked, debug (default is debug)"
echo "portableLinux - build for Portable Linux Distribution"
echo
exit 1
}

__ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
__PortableLinux=0

# Use uname to determine what the OS is.
OSName=$(uname -s)
case $OSName in
Linux)
__BuildOS=Linux
__HostOS=Linux
;;

Darwin)
__BuildOS=OSX
__HostOS=OSX
;;

FreeBSD)
__BuildOS=FreeBSD
__HostOS=FreeBSD
;;

OpenBSD)
__BuildOS=OpenBSD
__HostOS=OpenBSD
;;

NetBSD)
__BuildOS=NetBSD
__HostOS=NetBSD
;;

SunOS)
__BuildOS=SunOS
__HostOS=SunOS
;;

*)
echo "Unsupported OS $OSName detected, configuring as if for Linux"
__BuildOS=Linux
__HostOS=Linux
;;
esac

unprocessedBuildArgs=

Expand All @@ -28,13 +70,29 @@ while :; do
unprocessedBuildArgs="$unprocessedBuildArgs $1"
__Arch=$(echo $1| cut -d'=' -f 2)
;;

portableLinux)
if [ "$__BuildOS" == "Linux" ]; then
__PortableLinux=1
else
echo "ERROR: portableLinux not supported for non-Linux platforms."
exit 1
fi
;;
*)
unprocessedBuildArgs="$unprocessedBuildArgs $1"
esac
shift
done

$__ProjectRoot/run.sh build-packages -Project=$__ProjectRoot/src/.nuget/packages.builds -DistroRid=\${OSRid}-$__Arch -UseSharedCompilation=false -BuildNugetPackage=false $unprocessedBuildArgs
# Portable builds target the base RID only for Linux based platforms
if [ $__PortableLinux == 1 ]; then
export __DistroRid="linux-$__Arch"
else
export __DistroRid="\${OSRid}-$__Arch"
fi

$__ProjectRoot/run.sh build-packages -Project=$__ProjectRoot/src/.nuget/packages.builds -DistroRid=$__DistroRid -UseSharedCompilation=false -BuildNugetPackage=false $unprocessedBuildArgs
if [ $? -ne 0 ]
then
echo "ERROR: An error occurred while building packages; See build-packages.log for more details."
Expand Down

0 comments on commit 6694997

Please sign in to comment.