mirror of
https://github.com/godotengine/buildroot.git
synced 2025-12-31 09:48:56 +03:00
Add back the helper scripts
* x86_64 * i686 * armv7 * aarch64
This commit is contained in:
committed by
Hein-Pieter van Braam
parent
56f64339a4
commit
552ff0d1b3
6
Dockerfile.linux-builder
Normal file
6
Dockerfile.linux-builder
Normal file
@@ -0,0 +1,6 @@
|
||||
FROM almalinux:8
|
||||
|
||||
RUN yum -y update && \
|
||||
yum -y install make ncurses-devel which unzip perl cpio rsync fileutils bc bzip2 gzip sed git python3 file patch wget perl-Thread-Queue perl-Data-Dumper perl-ExtUtils-MakeMaker perl-IPC-Cmd gcc gcc-c++ && \
|
||||
yum clean all
|
||||
|
||||
102
build-sdk.sh
Executable file
102
build-sdk.sh
Executable file
@@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
function usage() {
|
||||
echo "usage: $0 host target"
|
||||
echo " where host is one of linux-x86_64, windows-x86_64"
|
||||
echo " where target is one of i686, x86_64, armv7"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ -z $1 ] || [ -z $1 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
linux-x86_64)
|
||||
host=$1
|
||||
;;
|
||||
windows-x86_64)
|
||||
host=$1
|
||||
;;
|
||||
*)
|
||||
echo "unknown SDK host \"$1\""
|
||||
usage
|
||||
esac
|
||||
|
||||
case $2 in
|
||||
i686)
|
||||
cp config-godot-i686 .config
|
||||
toolchain_prefix=i686-godot-linux-gnu
|
||||
bits=32
|
||||
;;
|
||||
x86_64)
|
||||
cp config-godot-x86_64 .config
|
||||
toolchain_prefix=x86_64-godot-linux-gnu
|
||||
bits=64
|
||||
;;
|
||||
armv7)
|
||||
cp config-godot-armv7 .config
|
||||
toolchain_prefix=arm-godot-linux-gnueabihf
|
||||
bits=32
|
||||
;;
|
||||
aarch64)
|
||||
cp config-godot-aarch64 .config
|
||||
toolchain_prefix=aarch64-godot-linux-gnu
|
||||
bits=64
|
||||
;;
|
||||
*)
|
||||
echo "unknown SDK target \"$2\""
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
if which podman &> /dev/null; then
|
||||
container=podman
|
||||
elif which docker &> /dev/null; then
|
||||
container=docker
|
||||
else
|
||||
echo "Podman or docker have to be in \$PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function build_linux_sdk() {
|
||||
${container} build -f Dockerfile.linux-builder -t godot-buildroot-builder-linux
|
||||
${container} run -it --rm -v $(pwd):/tmp/buildroot:z -w /tmp/buildroot -e FORCE_UNSAFE_CONFIGURE=1 --userns=keep-id godot-buildroot-builder-linux bash -c "make syncconfig; make clean sdk"
|
||||
|
||||
mkdir -p godot-toolchains
|
||||
|
||||
rm -fr godot-toolchains/${toolchain_prefix}_sdk-buildroot
|
||||
tar xf output/images/${toolchain_prefix}_sdk-buildroot.tar.gz -C godot-toolchains
|
||||
|
||||
pushd godot-toolchains/${toolchain_prefix}_sdk-buildroot
|
||||
../../clean-linux-toolchain.sh ${toolchain_prefix} ${bits}
|
||||
popd
|
||||
|
||||
pushd godot-toolchains
|
||||
tar -cjf ${toolchain_prefix}_sdk-buildroot.tar.bz2 ${toolchain_prefix}_sdk-buildroot
|
||||
rm -rf ${toolchain_prefix}_sdk-buildroot
|
||||
popd
|
||||
}
|
||||
|
||||
function build_windows_sdk() {
|
||||
${container} build -f Dockerfile.windows-builder -t godot-buildroot-builder-windows
|
||||
|
||||
if [ ! -e godot-toolchains/${toolchain_prefix}_sdk-buildroot.tar.bz2 ]; then
|
||||
build_linux_sdk
|
||||
fi
|
||||
|
||||
${container} run -it --rm -v $(pwd):/tmp/buildroot:z -w /tmp/buildroot --userns=keep-id godot-buildroot-builder-windows bash -x /usr/local/bin/build-windows.sh ${toolchain_prefix}
|
||||
}
|
||||
|
||||
if [ "${host}" == "linux-x86_64" ]; then
|
||||
build_linux_sdk
|
||||
fi
|
||||
|
||||
if [ "${host}" == "windows-x86_64" ]; then
|
||||
build_windows_sdk
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "***************************************"
|
||||
echo "Build succesful your toolchain is in the godot-toolchains directory"
|
||||
108
clean-linux-toolchain.sh
Executable file
108
clean-linux-toolchain.sh
Executable file
@@ -0,0 +1,108 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z $1 ] || [ -z $2 ]; then
|
||||
echo "usage: $0 arch bits"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
arch=$1
|
||||
bits=$2
|
||||
|
||||
bin_to_keep="aclocal autoconf autoheader automake autoreconf cmake gawk libtool m4 meson ninja pkgconf pkg-config python python3.11 scons tar toolchain-wrapper"
|
||||
lib_to_keep="cmake gcc libpkgconf libpython3.11 libz libisl libmpc libmpfr libgmp libffi python3.11 pkgconfig libm libmvec"
|
||||
share_to_keep="aclocal autoconf buildroot cmake gcc libtool pkgconfig"
|
||||
sysroot_share_to_keep="aclocal pkgconfig"
|
||||
|
||||
function clean_directory() {
|
||||
pushd $1
|
||||
files_to_keep="${@:2}"
|
||||
|
||||
for file in $(ls -1); do
|
||||
keep_file=0
|
||||
|
||||
if echo ${file} | grep -qe "^${arch}"; then
|
||||
keep_file=1
|
||||
fi
|
||||
|
||||
for keep in ${files_to_keep}; do
|
||||
if echo ${file} | grep -qe "^${keep}"; then
|
||||
keep_file=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${keep_file} -eq 0 ]; then
|
||||
rm -rf ${file}
|
||||
fi
|
||||
done
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
rm -f $(find -name *.a | grep -vE '(nonshared|gcc|libstdc++)')
|
||||
find -regex '.*\.so\(\..*\)?' -exec bin/${arch}-strip {} \; 2> /dev/null
|
||||
find bin -exec bin/${arch}-strip {} \; 2> /dev/null
|
||||
find ${arch}/bin -exec bin/${arch}-strip {} \; 2> /dev/null
|
||||
find libexec/gcc -type f -exec bin/${arch}-strip {} \; 2> /dev/null
|
||||
|
||||
clean_directory bin ${bin_to_keep}
|
||||
clean_directory lib ${lib_to_keep}
|
||||
clean_directory share ${share_to_keep}
|
||||
clean_directory ${arch}/sysroot/usr/share ${sysroot_share_to_keep}
|
||||
|
||||
find -name *.pyc -delete
|
||||
|
||||
rm -f usr lib64
|
||||
rm -rf sbin var
|
||||
|
||||
for s in bin lib lib64 sbin; do
|
||||
if [ -L ${arch}/sysroot/${s} ]; then
|
||||
rm -f ${arch}/sysroot/${s}
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${bits} == 64 ]; then
|
||||
libdir_to_remove=lib
|
||||
libdir_to_keep=lib64
|
||||
else
|
||||
libdir_to_remove=lib64
|
||||
libdir_to_keep=lib
|
||||
fi
|
||||
|
||||
rm -rf ${arch}/sysroot/usr/{bin,sbin}
|
||||
|
||||
mkdir -p ${arch}/sysroot/${libdir_to_keep}
|
||||
cp ${arch}/sysroot/usr/${libdir_to_keep}/libpthread*so* ${arch}/sysroot/${libdir_to_keep}
|
||||
cp ${arch}/sysroot/usr/${libdir_to_keep}/ld-linux*so* ${arch}/sysroot/${libdir_to_keep}
|
||||
cp ${arch}/sysroot/usr/${libdir_to_keep}/libc*so* ${arch}/sysroot/${libdir_to_keep}
|
||||
cp ${arch}/sysroot/usr/${libdir_to_keep}/libm.so* ${arch}/sysroot/${libdir_to_keep}
|
||||
cp ${arch}/sysroot/usr/${libdir_to_keep}/libmvec.so* ${arch}/sysroot/${libdir_to_keep} || /bin/true # Does not exist on arm
|
||||
|
||||
if [ -L ${arch}/sysroot/usr/${libdir_to_keep} ]; then
|
||||
rm ${arch}/sysroot/usr/${libdir_to_keep}
|
||||
mv ${arch}/sysroot/usr/${libdir_to_remove} ${arch}/sysroot/usr/${libdir_to_keep}
|
||||
mkdir ${arch}/sysroot/usr/${libdir_to_remove}
|
||||
mv ${arch}/sysroot/usr/${libdir_to_keep}/crt*.o ${arch}/sysroot/usr/${libdir_to_remove}
|
||||
mv ${arch}/sysroot/usr/${libdir_to_keep}/pkgconfig ${arch}/sysroot/usr/${libdir_to_remove}
|
||||
# But why tho
|
||||
mv ${arch}/sysroot/usr/${libdir_to_keep}/pulseaudio ${arch}/sysroot/usr/${libdir_to_remove}
|
||||
fi
|
||||
|
||||
mkdir -p ${arch}/sysroot/${libdir_to_remove}
|
||||
cp ${arch}/sysroot/usr/${libdir_to_keep}/ld-linux*so* ${arch}/sysroot/${libdir_to_remove} # aarch64 apparently wants ld-linux.so in /lib not /lib64?
|
||||
|
||||
ln -s ${arch}-gcc bin/gcc
|
||||
ln -s ${arch}-gcc.br_real bin/gcc.br_real
|
||||
ln -s ${arch}-g++ bin/g++
|
||||
ln -s ${arch}-g++.br_real bin/g++.br_real
|
||||
ln -s ${arch}-cpp bin/cpp
|
||||
ln -s ${arch}-cpp.br_real bin/cpp.br_real
|
||||
ln -s ${arch}-ar bin/ar
|
||||
ln -s ${arch}-ranlib bin/ranlib
|
||||
ln -s ${arch}-gcc-ar bin/gcc-ar
|
||||
ln -s ${arch}-gcc-ranlib bin/gcc-ranlib
|
||||
|
||||
find -name *python2* -exec rm -rf {} \; || true
|
||||
|
||||
4031
config-godot-aarch64
Normal file
4031
config-godot-aarch64
Normal file
File diff suppressed because it is too large
Load Diff
4091
config-godot-armv7
Normal file
4091
config-godot-armv7
Normal file
File diff suppressed because it is too large
Load Diff
4029
config-godot-i686
Normal file
4029
config-godot-i686
Normal file
File diff suppressed because it is too large
Load Diff
4031
config-godot-x86_64
Normal file
4031
config-godot-x86_64
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user