2022-02-02 12:35:39 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# helper script for me for when i cross compile
|
|
|
|
# t. jeff
|
|
|
|
#
|
2022-02-02 15:23:07 +00:00
|
|
|
set -e
|
|
|
|
|
2022-02-02 12:35:39 +00:00
|
|
|
die() {
|
|
|
|
echo $@
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2022-02-02 14:07:47 +00:00
|
|
|
platform=${PLATFORM:-Linux}
|
2022-02-02 12:35:39 +00:00
|
|
|
root="$(readlink -e $(dirname $0)/../)"
|
|
|
|
cd $root
|
|
|
|
mkdir -p build-cross
|
2022-02-02 15:23:07 +00:00
|
|
|
|
|
|
|
targets=()
|
2022-10-05 22:25:58 +00:00
|
|
|
cmake_extra=()
|
2022-02-02 15:23:07 +00:00
|
|
|
|
|
|
|
while [ "$#" -gt 0 ]; do
|
|
|
|
if [ "$1" = "--" ]; then
|
|
|
|
shift
|
2022-10-05 22:25:58 +00:00
|
|
|
cmake_extra=("$@")
|
2022-02-02 15:23:07 +00:00
|
|
|
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
|
2022-02-02 12:35:39 +00:00
|
|
|
cmake \
|
|
|
|
-G 'Unix Makefiles' \
|
2022-02-02 14:07:47 +00:00
|
|
|
-DCROSS_PLATFORM=$platform \
|
2022-02-02 15:23:07 +00:00
|
|
|
-DCROSS_PREFIX=$arch \
|
2022-02-02 12:35:39 +00:00
|
|
|
-DCMAKE_EXE_LINKER_FLAGS=-fstack-protector \
|
2022-02-02 15:23:07 +00:00
|
|
|
-DCMAKE_CXX_FLAGS=-fdiagnostics-color=always \
|
|
|
|
-DCMAKE_TOOLCHAIN_FILE=$root/contrib/cross/cross.toolchain.cmake \
|
2022-10-05 22:25:58 +00:00
|
|
|
-DBUILD_STATIC_DEPS=ON \
|
|
|
|
-DSTATIC_LINK=ON \
|
|
|
|
-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 \
|
|
|
|
"${cmake_extra[@]}" \
|
2022-02-02 12:40:52 +00:00
|
|
|
$root
|
|
|
|
cd $root/build-cross
|
2022-02-02 15:23:07 +00:00
|
|
|
echo -ne "$arch:\n\t\$(MAKE) -C build-$arch\n" >> $root/build-cross/Makefile
|
2022-02-02 12:35:39 +00:00
|
|
|
|
|
|
|
done
|
2022-02-02 12:40:52 +00:00
|
|
|
cd $root
|
2022-02-02 12:35:39 +00:00
|
|
|
make -j${JOBS:-$(nproc)} -C build-cross
|