Updated Linux build script + added script to build musl libc for all target platforms.
This commit is contained in:
parent
e78b144413
commit
5fbe240b51
33
etc/utils/linux/mk-musl.sh
Executable file
33
etc/utils/linux/mk-musl.sh
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# sudo apt install crossbuild-essential-i386
|
||||
# sudo apt install crossbuild-essential-arm64
|
||||
set -e
|
||||
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
|
||||
|
||||
function mk_musl() {
|
||||
local outdir="/usr/local/musl/${1}-linux-gnu"
|
||||
local build="musl-build-${1}"
|
||||
rm -rf "${build}" && mkdir -p "${build}"
|
||||
tar -xvf "musl-latest.tar.gz" --strip-components=1 -C "${build}"
|
||||
pushd "${build}"
|
||||
if [ -z "${2}" ]; then
|
||||
./configure --prefix="${outdir}"
|
||||
else
|
||||
./configure --host="${2}" --prefix="${outdir}"
|
||||
fi
|
||||
make
|
||||
sudo rm -rf "${outdir}"
|
||||
sudo make install
|
||||
popd
|
||||
}
|
||||
|
||||
if [ "$(gcc -dumpmachine)" != "x86_64-linux-gnu" ]; then
|
||||
echo "This script is supposed to run on the native \"x86_64-linux-gnu\" platform !!!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
curl -vkf -o "musl-latest.tar.gz" "https://musl.libc.org/releases/musl-latest.tar.gz"
|
||||
|
||||
mk_musl x86_64
|
||||
mk_musl i686 i686-linux-gnu
|
||||
mk_musl aarch64 aarch64-linux-gnu
|
@ -1,23 +1,23 @@
|
||||
#!/bin/bash
|
||||
# See "etc/utils/linux/mk-musl.sh" in order to build musl libc!
|
||||
set -e
|
||||
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
|
||||
|
||||
mkdir -p "out"
|
||||
function mk_slunk() {
|
||||
local command="make -B CC=/usr/local/musl/${1}-linux-gnu/bin/musl-gcc STATIC=1 STRIP=1 FLTO=1"
|
||||
if [ ! -z "${2}" ]; then
|
||||
command="${command} ${2}"
|
||||
fi
|
||||
$BASH -x -c "${command}"
|
||||
cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-${1}"
|
||||
}
|
||||
|
||||
rm -rf "out" && mkdir -p "out"
|
||||
|
||||
$BASH -x -c "make clean"
|
||||
|
||||
case "$(getconf LONG_BIT)" in
|
||||
"64")
|
||||
$BASH -x -c "make -B CC=musl-gcc CPU=64 FLTO=1 STATIC=1 STRIP=1 MARCH=x86-64 MTUNE=nocona"
|
||||
cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-x64"
|
||||
;;
|
||||
"32")
|
||||
$BASH -x -c "make -B CC=musl-gcc CPU=32 FLTO=1 STATIC=1 STRIP=1 MARCH=pentiumpro MTUNE=generic"
|
||||
cp -vf "frontend/bin/slunkcrypt" "out/slunkcrypt-i686"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown platform!"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
mk_slunk "x86_64" "MARCH=x86-64 MTUNE=nocona"
|
||||
mk_slunk "i686" "MARCH=pentiumpro MTUNE=generic"
|
||||
mk_slunk "aarch64"
|
||||
|
||||
printf "\033[1;32m\nBuild completed successfully.\033[0m\n\n"
|
||||
|
Loading…
Reference in New Issue
Block a user