redo contrib/cross.sh to take cmake arguments

pull/1849/head
Jeff 2 years ago
parent 66b7c3698e
commit 7251944adc

@ -3,6 +3,8 @@
# helper script for me for when i cross compile # helper script for me for when i cross compile
# t. jeff # t. jeff
# #
set -e
die() { die() {
echo $@ echo $@
exit 1 exit 1
@ -11,36 +13,52 @@ die() {
platform=${PLATFORM:-Linux} platform=${PLATFORM:-Linux}
root="$(readlink -e $(dirname $0)/../)" root="$(readlink -e $(dirname $0)/../)"
cd $root cd $root
set -e
test $# = 0 && die no targets provided
mkdir -p build-cross mkdir -p build-cross
echo "all: $@" > build-cross/Makefile
for targ in $@ ; do cmake_opts="-DBUILD_STATIC_DEPS=ON \
mkdir -p $root/build-cross/build-$targ -DSTATIC_LINK=ON \
cd $root/build-cross/build-$targ -DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DBUILD_LIBLOKINET=OFF \
-DWITH_TESTS=OFF \
-DNATIVE_BUILD=OFF \
-DSTATIC_LINK=ON \
-DWITH_SYSTEMD=OFF \
-DFORCE_OXENMQ_SUBMODULE=ON \
-DSUBMODULE_CHECK=OFF \
-DWITH_LTO=OFF \
-DWITH_BOOTSTRAP=OFF \
-DCMAKE_BUILD_TYPE=RelWithDeb"
targets=()
while [ "$#" -gt 0 ]; do
if [ "$1" = "--" ]; then
shift
cmake_opts=$@
break
fi
targets+=("$1")
shift
done
test ${#targets[@]} = 0 && die no targets provided
archs="${targets[@]}"
echo "all: $archs" > build-cross/Makefile
for arch in $archs ; do
mkdir -p $root/build-cross/build-$arch
cd $root/build-cross/build-$arch
cmake \ cmake \
-G 'Unix Makefiles' \ -G 'Unix Makefiles' \
-DCROSS_PLATFORM=$platform \ -DCROSS_PLATFORM=$platform \
-DCROSS_PREFIX=$targ \ -DCROSS_PREFIX=$arch \
-DCMAKE_EXE_LINKER_FLAGS=-fstack-protector \ -DCMAKE_EXE_LINKER_FLAGS=-fstack-protector \
-DCMAKE_CXX_FLAGS=-fdiagnostics-color=always\ -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always \
-DCMAKE_TOOLCHAIN_FILE=$root/contrib/cross/cross.toolchain.cmake\ -DCMAKE_TOOLCHAIN_FILE=$root/contrib/cross/cross.toolchain.cmake \
-DBUILD_STATIC_DEPS=ON \ $cmake_opts \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DBUILD_LIBLOKINET=OFF \
-DWITH_TESTS=OFF \
-DNATIVE_BUILD=OFF \
-DSTATIC_LINK=ON \
-DWITH_SYSTEMD=OFF \
-DFORCE_OXENMQ_SUBMODULE=ON \
-DSUBMODULE_CHECK=OFF \
-DWITH_LTO=OFF \
-DWITH_BOOTSTRAP=OFF \
-DCMAKE_BUILD_TYPE=Release \
$root $root
cd $root/build-cross cd $root/build-cross
echo -ne "$targ:\n\t\$(MAKE) -C build-$targ\n" >> $root/build-cross/Makefile echo -ne "$arch:\n\t\$(MAKE) -C build-$arch\n" >> $root/build-cross/Makefile
done done
cd $root cd $root

@ -80,9 +80,7 @@ current cross targets:
* mipsel-linux-gnu * mipsel-linux-gnu
* powerpc64le-linux-gnu * powerpc64le-linux-gnu
install the toolchain (this one is for `aarch64-linux-gnu`, you can provide your own toolchain if you want)
install the toolchain (this one is for `aarch64-linux-gnu`)
$ sudo apt install g{cc,++}-aarch64-linux-gnu $ sudo apt install g{cc,++}-aarch64-linux-gnu

Loading…
Cancel
Save