2018-11-08 01:51:56 +00:00
#!/usr/bin/env bash
2020-04-24 17:34:25 +00:00
set -e
2018-11-08 01:51:56 +00:00
usage( )
{
Update dependencies from https://github.com/dotnet/arcade build 20220422.4
Microsoft.DotNet.CMake.Sdk , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 7.0.0-beta.22215.2 -> To Version 7.0.0-beta.22222.4
Dependency coherency updates
Microsoft.NETCore.App.Ref,VS.Redist.Common.NetCore.TargetingPack.x64.7.0,Microsoft.NETCore.App.Runtime.win-x64,Microsoft.NETCore.App.Host.win-x64,Microsoft.NETCore.DotNetHostResolver,Microsoft.NETCore.Platforms,Microsoft.Net.Compilers.Toolset,VS.Redist.Common.NetCore.SharedFramework.x64.7.0,Microsoft.SourceLink.GitHub,Microsoft.DotNet.XliffTasks
From Version 7.0.0-preview.4.22217.5 -> To Version 7.0.0-preview.4.22216.4 (parent: Microsoft.NET.Sdk
2022-04-23 12:31:11 +00:00
echo " Usage: $0 [BuildArch] [CodeName] [lldbx.y] [llvmx[.y]] [--skipunmount] --rootfsdir <directory>] "
2022-07-29 12:36:00 +00:00
echo "BuildArch can be: arm(default), arm64, armel, armv6, ppc64le, riscv64, s390x, x64, x86"
2021-09-14 13:05:57 +00:00
echo "CodeName - optional, Code name for Linux, can be: xenial(default), zesty, bionic, alpine, alpine3.13 or alpine3.14. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen."
2022-01-26 18:30:11 +00:00
echo " for FreeBSD can be: freebsd12, freebsd13"
2022-08-11 12:40:33 +00:00
echo " for illumos can be: illumos"
echo " for Haiku can be: haiku."
2021-08-06 20:18:02 +00:00
echo "lldbx.y - optional, LLDB version, can be: lldb3.9(default), lldb4.0, lldb5.0, lldb6.0 no-lldb. Ignored for alpine and FreeBSD"
Update dependencies from https://github.com/dotnet/arcade build 20220422.4
Microsoft.DotNet.CMake.Sdk , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 7.0.0-beta.22215.2 -> To Version 7.0.0-beta.22222.4
Dependency coherency updates
Microsoft.NETCore.App.Ref,VS.Redist.Common.NetCore.TargetingPack.x64.7.0,Microsoft.NETCore.App.Runtime.win-x64,Microsoft.NETCore.App.Host.win-x64,Microsoft.NETCore.DotNetHostResolver,Microsoft.NETCore.Platforms,Microsoft.Net.Compilers.Toolset,VS.Redist.Common.NetCore.SharedFramework.x64.7.0,Microsoft.SourceLink.GitHub,Microsoft.DotNet.XliffTasks
From Version 7.0.0-preview.4.22217.5 -> To Version 7.0.0-preview.4.22216.4 (parent: Microsoft.NET.Sdk
2022-04-23 12:31:11 +00:00
echo "llvmx[.y] - optional, LLVM version for LLVM related packages."
2018-11-08 01:51:56 +00:00
echo "--skipunmount - optional, will skip the unmount of rootfs folder."
2020-06-11 17:47:07 +00:00
echo "--use-mirror - optional, use mirror URL to fetch resources, when available."
2022-08-11 12:40:33 +00:00
echo "--jobs N - optional, restrict to N jobs."
2018-11-08 01:51:56 +00:00
exit 1
}
2020-03-31 13:04:58 +00:00
__CodeName = xenial
2018-11-08 01:51:56 +00:00
__CrossDir = $( cd " $( dirname " ${ BASH_SOURCE [0] } " ) " && pwd )
__BuildArch = arm
2020-04-24 17:34:25 +00:00
__AlpineArch = armv7
2022-07-15 18:56:08 +00:00
__FreeBSDArch = arm
__FreeBSDMachineArch = armv7
__IllumosArch = arm7
2020-04-24 17:34:25 +00:00
__QEMUArch = arm
2018-11-08 01:51:56 +00:00
__UbuntuArch = armhf
__UbuntuRepo = "http://ports.ubuntu.com/"
2019-05-08 12:25:49 +00:00
__LLDB_Package = "liblldb-3.9-dev"
2018-11-08 01:51:56 +00:00
__SkipUnmount = 0
# base development support
__UbuntuPackages = "build-essential"
__AlpinePackages = "alpine-base"
__AlpinePackages += " build-base"
__AlpinePackages += " linux-headers"
2021-09-14 13:05:57 +00:00
__AlpinePackages += " lldb-dev"
__AlpinePackages += " python3"
__AlpinePackages += " libedit"
2018-11-08 01:51:56 +00:00
# symlinks fixer
__UbuntuPackages += " symlinks"
2022-07-28 12:36:53 +00:00
# runtime dependencies
2018-11-08 01:51:56 +00:00
__UbuntuPackages += " libicu-dev"
__UbuntuPackages += " liblttng-ust-dev"
__UbuntuPackages += " libunwind8-dev"
__AlpinePackages += " gettext-dev"
__AlpinePackages += " icu-dev"
__AlpinePackages += " libunwind-dev"
__AlpinePackages += " lttng-ust-dev"
Update dependencies from https://github.com/dotnet/arcade build 20220422.4
Microsoft.DotNet.CMake.Sdk , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 7.0.0-beta.22215.2 -> To Version 7.0.0-beta.22222.4
Dependency coherency updates
Microsoft.NETCore.App.Ref,VS.Redist.Common.NetCore.TargetingPack.x64.7.0,Microsoft.NETCore.App.Runtime.win-x64,Microsoft.NETCore.App.Host.win-x64,Microsoft.NETCore.DotNetHostResolver,Microsoft.NETCore.Platforms,Microsoft.Net.Compilers.Toolset,VS.Redist.Common.NetCore.SharedFramework.x64.7.0,Microsoft.SourceLink.GitHub,Microsoft.DotNet.XliffTasks
From Version 7.0.0-preview.4.22217.5 -> To Version 7.0.0-preview.4.22216.4 (parent: Microsoft.NET.Sdk
2022-04-23 12:31:11 +00:00
__AlpinePackages += " compiler-rt-static"
2018-11-08 01:51:56 +00:00
2022-07-28 12:36:53 +00:00
# runtime libraries' dependencies
2018-11-08 01:51:56 +00:00
__UbuntuPackages += " libcurl4-openssl-dev"
__UbuntuPackages += " libkrb5-dev"
__UbuntuPackages += " libssl-dev"
__UbuntuPackages += " zlib1g-dev"
__AlpinePackages += " curl-dev"
__AlpinePackages += " krb5-dev"
__AlpinePackages += " openssl-dev"
__AlpinePackages += " zlib-dev"
2022-01-26 18:30:11 +00:00
__FreeBSDBase = "12.3-RELEASE"
__FreeBSDPkg = "1.17.0"
2021-08-06 20:18:02 +00:00
__FreeBSDABI = "12"
2020-03-31 13:04:58 +00:00
__FreeBSDPackages = "libunwind"
__FreeBSDPackages += " icu"
__FreeBSDPackages += " libinotify"
2022-01-26 18:30:11 +00:00
__FreeBSDPackages += " openssl"
2020-03-31 13:04:58 +00:00
__FreeBSDPackages += " krb5"
2021-08-06 20:18:02 +00:00
__FreeBSDPackages += " terminfo-db"
2020-03-31 13:04:58 +00:00
2022-08-19 18:54:19 +00:00
__IllumosPackages = "icu"
__IllumosPackages += " mit-krb5"
__IllumosPackages += " openssl"
__IllumosPackages += " zlib"
2020-06-11 17:47:07 +00:00
2022-08-11 12:40:33 +00:00
__HaikuPackages = "gmp"
__HaikuPackages += " gmp_devel"
__HaikuPackages += " krb5"
__HaikuPackages += " krb5_devel"
__HaikuPackages += " libiconv"
__HaikuPackages += " libiconv_devel"
__HaikuPackages += " llvm12_libunwind"
__HaikuPackages += " llvm12_libunwind_devel"
__HaikuPackages += " mpfr"
__HaikuPackages += " mpfr_devel"
2021-05-05 13:06:29 +00:00
# ML.NET dependencies
__UbuntuPackages += " libomp5"
__UbuntuPackages += " libomp-dev"
2022-07-28 12:36:53 +00:00
__Keyring =
2020-06-11 17:47:07 +00:00
__UseMirror = 0
2018-11-08 01:51:56 +00:00
__UnprocessedBuildArgs =
2019-05-08 12:25:49 +00:00
while :; do
2022-07-28 12:36:53 +00:00
if [ [ " $# " -le 0 ] ] ; then
2019-05-08 12:25:49 +00:00
break
fi
2022-07-28 12:36:53 +00:00
lowerI = " $( echo " $1 " | tr "[:upper:]" "[:lower:]" ) "
2018-11-08 01:51:56 +00:00
case $lowerI in
2022-07-28 12:36:53 +00:00
-\? | -h| --help)
2018-11-08 01:51:56 +00:00
usage
exit 1
; ;
arm)
__BuildArch = arm
__UbuntuArch = armhf
2020-04-24 17:34:25 +00:00
__AlpineArch = armv7
2018-11-08 01:51:56 +00:00
__QEMUArch = arm
; ;
arm64)
__BuildArch = arm64
__UbuntuArch = arm64
__AlpineArch = aarch64
__QEMUArch = aarch64
2022-07-15 18:56:08 +00:00
__FreeBSDArch = arm64
__FreeBSDMachineArch = aarch64
2018-11-08 01:51:56 +00:00
; ;
armel)
__BuildArch = armel
__UbuntuArch = armel
__UbuntuRepo = "http://ftp.debian.org/debian/"
2020-03-31 13:04:58 +00:00
__CodeName = jessie
2018-11-08 01:51:56 +00:00
; ;
2022-07-29 12:36:00 +00:00
armv6)
__BuildArch = armv6
__UbuntuArch = armhf
__QEMUArch = arm
__UbuntuRepo = "http://raspbian.raspberrypi.org/raspbian/"
__CodeName = buster
__LLDB_Package = "liblldb-6.0-dev"
if [ [ -e "/usr/share/keyrings/raspbian-archive-keyring.gpg" ] ] ; then
__Keyring = "--keyring /usr/share/keyrings/raspbian-archive-keyring.gpg"
fi
; ;
2022-02-11 16:15:13 +00:00
ppc64le)
__BuildArch = ppc64le
__UbuntuArch = ppc64el
__UbuntuRepo = "http://ports.ubuntu.com/ubuntu-ports/"
__UbuntuPackages = $( echo ${ __UbuntuPackages } | sed 's/ libunwind8-dev//' )
__UbuntuPackages = $( echo ${ __UbuntuPackages } | sed 's/ libomp-dev//' )
__UbuntuPackages = $( echo ${ __UbuntuPackages } | sed 's/ libomp5//' )
unset __LLDB_Package
; ;
2022-07-29 12:36:00 +00:00
riscv64)
__BuildArch = riscv64
__UbuntuArch = riscv64
__UbuntuRepo = "http://deb.debian.org/debian-ports"
__CodeName = sid
__UbuntuPackages = $( echo ${ __UbuntuPackages } | sed 's/ libunwind8-dev//' )
unset __LLDB_Package
if [ [ -e "/usr/share/keyrings/debian-ports-archive-keyring.gpg" ] ] ; then
__Keyring = "--keyring /usr/share/keyrings/debian-ports-archive-keyring.gpg --include=debian-ports-archive-keyring"
fi
; ;
2020-10-29 12:58:51 +00:00
s390x)
__BuildArch = s390x
__UbuntuArch = s390x
__UbuntuRepo = "http://ports.ubuntu.com/ubuntu-ports/"
__UbuntuPackages = $( echo ${ __UbuntuPackages } | sed 's/ libunwind8-dev//' )
2021-07-14 16:48:29 +00:00
__UbuntuPackages = $( echo ${ __UbuntuPackages } | sed 's/ libomp-dev//' )
__UbuntuPackages = $( echo ${ __UbuntuPackages } | sed 's/ libomp5//' )
2020-10-29 12:58:51 +00:00
unset __LLDB_Package
; ;
2022-07-15 18:56:08 +00:00
x64)
__BuildArch = x64
__UbuntuArch = amd64
__FreeBSDArch = amd64
__FreeBSDMachineArch = amd64
__illumosArch = x86_64
__UbuntuRepo =
; ;
2018-11-08 01:51:56 +00:00
x86)
__BuildArch = x86
__UbuntuArch = i386
__UbuntuRepo = "http://archive.ubuntu.com/ubuntu/"
; ;
2022-09-12 14:14:15 +00:00
lldb*)
version = " ${ lowerI /lldb/ } "
parts = ( ${ version //./ } )
# for versions > 6.0, lldb has dropped the minor version
if [ [ " ${ parts [0] } " -gt 6 ] ] ; then
version = " ${ parts [0] } "
fi
__LLDB_Package = " liblldb- ${ version } -dev "
2019-05-08 12:25:49 +00:00
; ;
2018-11-08 01:51:56 +00:00
no-lldb)
unset __LLDB_Package
; ;
Update dependencies from https://github.com/dotnet/arcade build 20220422.4
Microsoft.DotNet.CMake.Sdk , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 7.0.0-beta.22215.2 -> To Version 7.0.0-beta.22222.4
Dependency coherency updates
Microsoft.NETCore.App.Ref,VS.Redist.Common.NetCore.TargetingPack.x64.7.0,Microsoft.NETCore.App.Runtime.win-x64,Microsoft.NETCore.App.Host.win-x64,Microsoft.NETCore.DotNetHostResolver,Microsoft.NETCore.Platforms,Microsoft.Net.Compilers.Toolset,VS.Redist.Common.NetCore.SharedFramework.x64.7.0,Microsoft.SourceLink.GitHub,Microsoft.DotNet.XliffTasks
From Version 7.0.0-preview.4.22217.5 -> To Version 7.0.0-preview.4.22216.4 (parent: Microsoft.NET.Sdk
2022-04-23 12:31:11 +00:00
llvm*)
2022-09-12 14:14:15 +00:00
version = " ${ lowerI /llvm/ } "
Update dependencies from https://github.com/dotnet/arcade build 20220422.4
Microsoft.DotNet.CMake.Sdk , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 7.0.0-beta.22215.2 -> To Version 7.0.0-beta.22222.4
Dependency coherency updates
Microsoft.NETCore.App.Ref,VS.Redist.Common.NetCore.TargetingPack.x64.7.0,Microsoft.NETCore.App.Runtime.win-x64,Microsoft.NETCore.App.Host.win-x64,Microsoft.NETCore.DotNetHostResolver,Microsoft.NETCore.Platforms,Microsoft.Net.Compilers.Toolset,VS.Redist.Common.NetCore.SharedFramework.x64.7.0,Microsoft.SourceLink.GitHub,Microsoft.DotNet.XliffTasks
From Version 7.0.0-preview.4.22217.5 -> To Version 7.0.0-preview.4.22216.4 (parent: Microsoft.NET.Sdk
2022-04-23 12:31:11 +00:00
parts = ( ${ version //./ } )
__LLVM_MajorVersion = " ${ parts [0] } "
__LLVM_MinorVersion = " ${ parts [1] } "
2022-09-12 14:14:15 +00:00
# for versions > 6.0, llvm has dropped the minor version
Update dependencies from https://github.com/dotnet/arcade build 20220422.4
Microsoft.DotNet.CMake.Sdk , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 7.0.0-beta.22215.2 -> To Version 7.0.0-beta.22222.4
Dependency coherency updates
Microsoft.NETCore.App.Ref,VS.Redist.Common.NetCore.TargetingPack.x64.7.0,Microsoft.NETCore.App.Runtime.win-x64,Microsoft.NETCore.App.Host.win-x64,Microsoft.NETCore.DotNetHostResolver,Microsoft.NETCore.Platforms,Microsoft.Net.Compilers.Toolset,VS.Redist.Common.NetCore.SharedFramework.x64.7.0,Microsoft.SourceLink.GitHub,Microsoft.DotNet.XliffTasks
From Version 7.0.0-preview.4.22217.5 -> To Version 7.0.0-preview.4.22216.4 (parent: Microsoft.NET.Sdk
2022-04-23 12:31:11 +00:00
if [ [ -z " $__LLVM_MinorVersion " && " $__LLVM_MajorVersion " -le 6 ] ] ; then
__LLVM_MinorVersion = 0;
fi
; ;
2019-05-15 12:11:39 +00:00
xenial) # Ubuntu 16.04
2022-07-28 12:36:53 +00:00
if [ [ " $__CodeName " != "jessie" ] ] ; then
2020-03-31 13:04:58 +00:00
__CodeName = xenial
2018-11-08 01:51:56 +00:00
fi
; ;
2019-05-15 12:11:39 +00:00
zesty) # Ubuntu 17.04
2022-07-28 12:36:53 +00:00
if [ [ " $__CodeName " != "jessie" ] ] ; then
2020-03-31 13:04:58 +00:00
__CodeName = zesty
2018-11-08 01:51:56 +00:00
fi
; ;
2019-05-08 12:25:49 +00:00
bionic) # Ubuntu 18.04
2022-07-28 12:36:53 +00:00
if [ [ " $__CodeName " != "jessie" ] ] ; then
2020-03-31 13:04:58 +00:00
__CodeName = bionic
2018-11-08 01:51:56 +00:00
fi
; ;
2022-09-12 14:14:15 +00:00
focal) # Ubuntu 20.04
if [ [ " $__CodeName " != "jessie" ] ] ; then
__CodeName = focal
fi
; ;
jammy) # Ubuntu 22.04
if [ [ " $__CodeName " != "jessie" ] ] ; then
__CodeName = jammy
fi
; ;
2019-05-08 12:25:49 +00:00
jessie) # Debian 8
2020-03-31 13:04:58 +00:00
__CodeName = jessie
2018-11-08 01:51:56 +00:00
__UbuntuRepo = "http://ftp.debian.org/debian/"
; ;
2019-05-15 12:11:39 +00:00
stretch) # Debian 9
2020-03-31 13:04:58 +00:00
__CodeName = stretch
2019-05-15 12:11:39 +00:00
__UbuntuRepo = "http://ftp.debian.org/debian/"
__LLDB_Package = "liblldb-6.0-dev"
; ;
buster) # Debian 10
2020-03-31 13:04:58 +00:00
__CodeName = buster
2019-05-15 12:11:39 +00:00
__UbuntuRepo = "http://ftp.debian.org/debian/"
__LLDB_Package = "liblldb-6.0-dev"
; ;
2018-11-08 01:51:56 +00:00
tizen)
2020-03-31 13:04:58 +00:00
__CodeName =
2018-11-08 01:51:56 +00:00
__UbuntuRepo =
__Tizen = tizen
; ;
2021-09-14 13:05:57 +00:00
alpine| alpine3.13)
2020-03-31 13:04:58 +00:00
__CodeName = alpine
2018-11-08 01:51:56 +00:00
__UbuntuRepo =
2021-09-14 13:05:57 +00:00
__AlpineVersion = 3.13
__AlpinePackages += " llvm10-libs"
2021-02-26 13:51:15 +00:00
; ;
2021-09-14 13:05:57 +00:00
alpine3.14)
2021-02-26 13:51:15 +00:00
__CodeName = alpine
__UbuntuRepo =
2021-09-14 13:05:57 +00:00
__AlpineVersion = 3.14
__AlpinePackages += " llvm11-libs"
2018-11-08 01:51:56 +00:00
; ;
2020-03-31 13:04:58 +00:00
freebsd12)
__CodeName = freebsd
__SkipUnmount = 1
; ;
2021-08-06 20:18:02 +00:00
freebsd13)
__CodeName = freebsd
__FreeBSDBase = "13.0-RELEASE"
__FreeBSDABI = "13"
__SkipUnmount = 1
2021-08-07 13:00:09 +00:00
; ;
2020-06-11 17:47:07 +00:00
illumos)
__CodeName = illumos
__SkipUnmount = 1
; ;
2022-08-11 12:40:33 +00:00
haiku)
__CodeName = haiku
__BuildArch = x64
__SkipUnmount = 1
; ;
2018-11-08 01:51:56 +00:00
--skipunmount)
__SkipUnmount = 1
; ;
2019-05-08 12:25:49 +00:00
--rootfsdir| -rootfsdir)
shift
2022-07-28 12:36:53 +00:00
__RootfsDir = " $1 "
2019-05-08 12:25:49 +00:00
; ;
2020-06-11 17:47:07 +00:00
--use-mirror)
__UseMirror = 1
; ;
2022-08-11 12:40:33 +00:00
--use-jobs)
shift
MAXJOBS = $1
; ;
2018-11-08 01:51:56 +00:00
*)
2019-05-08 12:25:49 +00:00
__UnprocessedBuildArgs = " $__UnprocessedBuildArgs $1 "
2018-11-08 01:51:56 +00:00
; ;
esac
2019-05-08 12:25:49 +00:00
shift
2018-11-08 01:51:56 +00:00
done
2022-07-28 12:36:53 +00:00
if [ [ " $__BuildArch " = = "armel" ] ] ; then
2018-11-08 01:51:56 +00:00
__LLDB_Package = "lldb-3.5-dev"
fi
2022-07-28 12:36:53 +00:00
2018-11-08 01:51:56 +00:00
__UbuntuPackages += " ${ __LLDB_Package :- } "
2022-07-28 12:36:53 +00:00
if [ [ -n " $__LLVM_MajorVersion " ] ] ; then
Update dependencies from https://github.com/dotnet/arcade build 20220422.4
Microsoft.DotNet.CMake.Sdk , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk
From Version 7.0.0-beta.22215.2 -> To Version 7.0.0-beta.22222.4
Dependency coherency updates
Microsoft.NETCore.App.Ref,VS.Redist.Common.NetCore.TargetingPack.x64.7.0,Microsoft.NETCore.App.Runtime.win-x64,Microsoft.NETCore.App.Host.win-x64,Microsoft.NETCore.DotNetHostResolver,Microsoft.NETCore.Platforms,Microsoft.Net.Compilers.Toolset,VS.Redist.Common.NetCore.SharedFramework.x64.7.0,Microsoft.SourceLink.GitHub,Microsoft.DotNet.XliffTasks
From Version 7.0.0-preview.4.22217.5 -> To Version 7.0.0-preview.4.22216.4 (parent: Microsoft.NET.Sdk
2022-04-23 12:31:11 +00:00
__UbuntuPackages += " libclang-common- ${ __LLVM_MajorVersion } ${ __LLVM_MinorVersion : +. $__LLVM_MinorVersion } -dev "
fi
2022-07-28 12:36:53 +00:00
if [ [ -z " $__RootfsDir " && -n " $ROOTFS_DIR " ] ] ; then
__RootfsDir = " $ROOTFS_DIR "
2018-11-08 01:51:56 +00:00
fi
2022-07-28 12:36:53 +00:00
if [ [ -z " $__RootfsDir " ] ] ; then
2019-06-05 12:10:31 +00:00
__RootfsDir = " $__CrossDir /../../../.tools/rootfs/ $__BuildArch "
2019-05-08 12:25:49 +00:00
fi
2022-07-28 12:36:53 +00:00
if [ [ -d " $__RootfsDir " ] ] ; then
if [ [ " $__SkipUnmount " = = "0" ] ] ; then
umount " $__RootfsDir " /* || true
2018-11-08 01:51:56 +00:00
fi
2022-07-28 12:36:53 +00:00
rm -rf " $__RootfsDir "
2018-11-08 01:51:56 +00:00
fi
2022-07-28 12:36:53 +00:00
mkdir -p " $__RootfsDir "
2020-06-11 17:47:07 +00:00
__RootfsDir = " $( cd " $__RootfsDir " && pwd ) "
2020-03-31 13:04:58 +00:00
if [ [ " $__CodeName " = = "alpine" ] ] ; then
2018-11-08 01:51:56 +00:00
__ApkToolsVersion = 2.9.1
2022-07-28 12:36:53 +00:00
__ApkToolsDir = " $( mktemp -d) "
wget " https://github.com/alpinelinux/apk-tools/releases/download/v $__ApkToolsVersion /apk-tools- $__ApkToolsVersion -x86_64-linux.tar.gz " -P " $__ApkToolsDir "
tar -xf " $__ApkToolsDir /apk-tools- $__ApkToolsVersion -x86_64-linux.tar.gz " -C " $__ApkToolsDir "
mkdir -p " $__RootfsDir " /usr/bin
cp -v " /usr/bin/qemu- $__QEMUArch -static " " $__RootfsDir /usr/bin "
2020-01-22 13:31:03 +00:00
2022-07-28 12:36:53 +00:00
" $__ApkToolsDir /apk-tools- $__ApkToolsVersion /apk " \
-X " http://dl-cdn.alpinelinux.org/alpine/v $__AlpineVersion /main " \
-X " http://dl-cdn.alpinelinux.org/alpine/v $__AlpineVersion /community " \
-U --allow-untrusted --root " $__RootfsDir " --arch " $__AlpineArch " --initdb \
2018-11-08 01:51:56 +00:00
add $__AlpinePackages
2020-01-22 13:31:03 +00:00
2022-07-28 12:36:53 +00:00
rm -r " $__ApkToolsDir "
2020-03-31 13:04:58 +00:00
elif [ [ " $__CodeName " = = "freebsd" ] ] ; then
2022-07-28 12:36:53 +00:00
mkdir -p " $__RootfsDir " /usr/local/etc
2022-08-11 12:40:33 +00:00
JOBS = ${ MAXJOBS : = " $( getconf _NPROCESSORS_ONLN) " }
2022-07-28 12:36:53 +00:00
wget -O - " https://download.freebsd.org/ftp/releases/ ${ __FreeBSDArch } / ${ __FreeBSDMachineArch } / ${ __FreeBSDBase } /base.txz " | tar -C " $__RootfsDir " -Jxf - ./lib ./usr/lib ./usr/libdata ./usr/include ./usr/share/keys ./etc ./bin/freebsd-version
echo " ABI = \"FreeBSD: ${ __FreeBSDABI } : ${ __FreeBSDMachineArch } \"; FINGERPRINTS = \" ${ __RootfsDir } /usr/share/keys\"; REPOS_DIR = [\" ${ __RootfsDir } /etc/pkg\"]; REPO_AUTOUPDATE = NO; RUN_SCRIPTS = NO; " > " ${ __RootfsDir } " /usr/local/etc/pkg.conf
echo " FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly\", mirror_type: \"srv\", signature_type: \"fingerprints\", fingerprints: \" ${ __RootfsDir } /usr/share/keys/pkg\", enabled: yes } " > " ${ __RootfsDir } " /etc/pkg/FreeBSD.conf
mkdir -p " $__RootfsDir " /tmp
2020-03-31 13:04:58 +00:00
# get and build package manager
2022-07-28 12:36:53 +00:00
wget -O - " https://github.com/freebsd/pkg/archive/ ${ __FreeBSDPkg } .tar.gz " | tar -C " $__RootfsDir " /tmp -zxf -
cd " $__RootfsDir /tmp/pkg- ${ __FreeBSDPkg } "
2020-04-24 17:34:25 +00:00
# needed for install to succeed
2022-07-28 12:36:53 +00:00
mkdir -p " $__RootfsDir " /host/etc
./autogen.sh && ./configure --prefix= " $__RootfsDir " /host && make -j " $JOBS " && make install
rm -rf " $__RootfsDir /tmp/pkg- ${ __FreeBSDPkg } "
2020-03-31 13:04:58 +00:00
# install packages we need.
2022-07-28 12:36:53 +00:00
INSTALL_AS_USER = $( whoami) " $__RootfsDir " /host/sbin/pkg -r " $__RootfsDir " -C " $__RootfsDir " /usr/local/etc/pkg.conf update
INSTALL_AS_USER = $( whoami) " $__RootfsDir " /host/sbin/pkg -r " $__RootfsDir " -C " $__RootfsDir " /usr/local/etc/pkg.conf install --yes $__FreeBSDPackages
2020-06-11 17:47:07 +00:00
elif [ [ " $__CodeName " = = "illumos" ] ] ; then
mkdir " $__RootfsDir /tmp "
pushd " $__RootfsDir /tmp "
2022-08-11 12:40:33 +00:00
JOBS = ${ MAXJOBS : = " $( getconf _NPROCESSORS_ONLN) " }
2020-06-11 17:47:07 +00:00
echo "Downloading sysroot."
wget -O - https://github.com/illumos/sysroot/releases/download/20181213-de6af22ae73b-v1/illumos-sysroot-i386-20181213-de6af22ae73b-v1.tar.gz | tar -C " $__RootfsDir " -xzf -
echo "Building binutils. Please wait.."
wget -O - https://ftp.gnu.org/gnu/binutils/binutils-2.33.1.tar.bz2 | tar -xjf -
mkdir build-binutils && cd build-binutils
2022-07-15 18:56:08 +00:00
../binutils-2.33.1/configure --prefix= " $__RootfsDir " --target= " ${ __illumosArch } -sun-solaris2.10 " --program-prefix= " ${ __illumosArch } -illumos- " --with-sysroot= " $__RootfsDir "
2020-06-11 17:47:07 +00:00
make -j " $JOBS " && make install && cd ..
echo "Building gcc. Please wait.."
wget -O - https://ftp.gnu.org/gnu/gcc/gcc-8.4.0/gcc-8.4.0.tar.xz | tar -xJf -
CFLAGS = "-fPIC"
CXXFLAGS = "-fPIC"
CXXFLAGS_FOR_TARGET = "-fPIC"
CFLAGS_FOR_TARGET = "-fPIC"
export CFLAGS CXXFLAGS CXXFLAGS_FOR_TARGET CFLAGS_FOR_TARGET
mkdir build-gcc && cd build-gcc
2022-07-15 18:56:08 +00:00
../gcc-8.4.0/configure --prefix= " $__RootfsDir " --target= " ${ __illumosArch } -sun-solaris2.10 " --program-prefix= " ${ __illumosArch } -illumos- " --with-sysroot= " $__RootfsDir " --with-gnu-as \
2020-06-11 17:47:07 +00:00
--with-gnu-ld --disable-nls --disable-libgomp --disable-libquadmath --disable-libssp --disable-libvtv --disable-libcilkrts --disable-libada --disable-libsanitizer \
--disable-libquadmath-support --disable-shared --enable-tls
make -j " $JOBS " && make install && cd ..
BaseUrl = https://pkgsrc.joyent.com
if [ [ " $__UseMirror " = = 1 ] ] ; then
BaseUrl = http://pkgsrc.smartos.skylime.net
fi
2022-08-19 18:54:19 +00:00
BaseUrl = " $BaseUrl /packages/SmartOS/trunk/ ${ __illumosArch } /All "
echo "Downloading manifest"
wget " $BaseUrl "
2020-06-11 17:47:07 +00:00
echo "Downloading dependencies."
read -ra array <<< " $__IllumosPackages "
for package in " ${ array [@] } " ; do
2022-08-19 18:54:19 +00:00
echo " Installing ' $package ' "
package = " $( grep " > $package -[0-9] " All | sed -En 's/.*href="(.*)\.tgz".*/\1/p' ) "
echo " Resolved name ' $package ' "
2020-06-11 17:47:07 +00:00
wget " $BaseUrl " /" $package " .tgz
ar -x " $package " .tgz
2022-08-19 18:54:19 +00:00
tar --skip-old-files -xzf " $package " .tmp.tg* -C " $__RootfsDir " 2>/dev/null
2020-06-11 17:47:07 +00:00
done
echo "Cleaning up temporary files."
popd
rm -rf " $__RootfsDir " /{ tmp,+*}
mkdir -p " $__RootfsDir " /usr/include/net
mkdir -p " $__RootfsDir " /usr/include/netpacket
wget -P " $__RootfsDir " /usr/include/net https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/io/bpf/net/bpf.h
wget -P " $__RootfsDir " /usr/include/net https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/io/bpf/net/dlt.h
wget -P " $__RootfsDir " /usr/include/netpacket https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/inet/sockmods/netpacket/packet.h
wget -P " $__RootfsDir " /usr/include/sys https://raw.githubusercontent.com/illumos/illumos-gate/master/usr/src/uts/common/sys/sdt.h
2022-08-11 12:40:33 +00:00
elif [ [ " $__CodeName " = = "haiku" ] ] ; then
JOBS = ${ MAXJOBS : = " $( getconf _NPROCESSORS_ONLN) " }
echo "Building Haiku sysroot for x86_64"
mkdir -p " $__RootfsDir /tmp "
cd " $__RootfsDir /tmp "
git clone -b hrev56235 https://review.haiku-os.org/haiku
git clone -b btrev43195 https://review.haiku-os.org/buildtools
cd " $__RootfsDir /tmp/buildtools " && git checkout 7487388f5110021d400b9f3b88e1a7f310dc066d
# Fetch some unmerged patches
cd " $__RootfsDir /tmp/haiku "
## Add development build profile (slimmer than nightly)
git fetch origin refs/changes/64/4164/1 && git -c commit.gpgsign= false cherry-pick FETCH_HEAD
# Build jam
cd " $__RootfsDir /tmp/buildtools/jam "
make
# Configure cross tools
echo "Building cross-compiler"
mkdir -p " $__RootfsDir /generated "
cd " $__RootfsDir /generated "
" $__RootfsDir /tmp/haiku/configure " -j" $JOBS " --sysroot " $__RootfsDir " --cross-tools-source " $__RootfsDir /tmp/buildtools " --build-cross-tools x86_64
# Build Haiku packages
echo "Building Haiku"
echo 'HAIKU_BUILD_PROFILE = "development-raw" ;' > UserProfileConfig
" $__RootfsDir /tmp/buildtools/jam/jam0 " -j" $JOBS " -q '<build>package' '<repository>Haiku'
BaseUrl = "https://depot.haiku-os.org/__api/v2/pkg/get-pkg"
# Download additional packages
echo "Downloading additional required packages"
read -ra array <<< " $__HaikuPackages "
for package in " ${ array [@] } " ; do
echo " Downloading $package ... "
# API documented here: https://github.com/haiku/haikudepotserver/blob/master/haikudepotserver-api2/src/main/resources/api2/pkg.yaml#L60
# The schema here: https://github.com/haiku/haikudepotserver/blob/master/haikudepotserver-api2/src/main/resources/api2/pkg.yaml#L598
hpkgDownloadUrl = " $( wget -qO- --post-data= '{"name":"' " $package " '","repositorySourceCode":"haikuports_x86_64","versionType":"LATEST","naturalLanguageCode":"en"}' \
--header= 'Content-Type:application/json' " $BaseUrl " | jq -r '.result.versions[].hpkgDownloadURL' ) "
wget -P " $__RootfsDir /generated/download " " $hpkgDownloadUrl "
done
# Setup the sysroot
echo "Setting up sysroot and extracting needed packages"
mkdir -p " $__RootfsDir /boot/system "
for file in " $__RootfsDir /generated/objects/haiku/x86_64/packaging/packages/ " *.hpkg; do
" $__RootfsDir /generated/objects/linux/x86_64/release/tools/package/package " extract -C " $__RootfsDir /boot/system " " $file "
done
for file in " $__RootfsDir /generated/download/ " *.hpkg; do
" $__RootfsDir /generated/objects/linux/x86_64/release/tools/package/package " extract -C " $__RootfsDir /boot/system " " $file "
done
# Cleaning up temporary files
echo "Cleaning up temporary files"
rm -rf " $__RootfsDir /tmp "
for name in " $__RootfsDir /generated/ " *; do
if [ [ " $name " = ~ "cross-tools-" ] ] ; then
: # Keep the cross-compiler
else
rm -rf " $name "
fi
done
2022-07-28 12:36:53 +00:00
elif [ [ -n " $__CodeName " ] ] ; then
qemu-debootstrap $__Keyring --arch " $__UbuntuArch " " $__CodeName " " $__RootfsDir " " $__UbuntuRepo "
cp " $__CrossDir / $__BuildArch /sources.list. $__CodeName " " $__RootfsDir /etc/apt/sources.list "
chroot " $__RootfsDir " apt-get update
chroot " $__RootfsDir " apt-get -f -y install
chroot " $__RootfsDir " apt-get -y install $__UbuntuPackages
chroot " $__RootfsDir " symlinks -cr /usr
chroot " $__RootfsDir " apt-get clean
2018-11-08 01:51:56 +00:00
2022-07-28 12:36:53 +00:00
if [ [ " $__SkipUnmount " = = "0" ] ] ; then
umount " $__RootfsDir " /* || true
2018-11-08 01:51:56 +00:00
fi
2020-11-20 17:08:04 +00:00
if [ [ " $__BuildArch " = = "armel" && " $__CodeName " = = "jessie" ] ] ; then
2022-07-28 12:36:53 +00:00
pushd " $__RootfsDir "
patch -p1 < " $__CrossDir / $__BuildArch /armel.jessie.patch "
2020-11-20 17:08:04 +00:00
popd
fi
2020-06-11 17:47:07 +00:00
elif [ [ " $__Tizen " = = "tizen" ] ] ; then
2022-07-29 12:36:00 +00:00
ROOTFS_DIR = " $__RootfsDir " " $__CrossDir / $__BuildArch /tizen-build-rootfs.sh "
2018-11-08 01:51:56 +00:00
else
echo "Unsupported target platform."
usage;
exit 1
fi