static-toolbox/build/targets/build_strace.sh

49 lines
1.5 KiB
Bash
Raw Normal View History

2020-11-04 11:41:52 +00:00
#!/bin/bash
set -e
set -x
set -o pipefail
if [ "$#" -ne 1 ];then
echo "Usage: ${0} [x86|x86_64|armhf|aarch64]"
echo "Example: ${0} x86_64"
exit 1
fi
source $GITHUB_WORKSPACE/build/lib.sh
init_lib "$1"
2023-05-16 07:51:29 +00:00
VERSION="v6.3"
2020-11-04 11:41:52 +00:00
build_strace() {
fetch "https://github.com/strace/strace" "${BUILD_DIRECTORY}/strace" git
cd "${BUILD_DIRECTORY}/strace"
git clean -fdx
2023-05-16 07:51:29 +00:00
git checkout "$VERSION"
2020-11-04 11:41:52 +00:00
./bootstrap
CMD="CFLAGS=\"${GCC_OPTS}\" "
CMD+="CXXFLAGS=\"${GXX_OPTS}\" "
CMD+="LDFLAGS=\"-static -pthread\" "
2023-05-16 07:51:29 +00:00
if [ "$CURRENT_ARCH" != "x86_64" ];then
CMD+="CC_FOR_BUILD=\"/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc\" "
CMD+="CPP_FOR_BUILD=\"/x86_64-linux-musl-cross/bin/x86_64-linux-musl-g++ -E\" "
2023-05-19 09:38:41 +00:00
CMD+="CXX_FOR_BUILD=\"/x86_64-linux-musl-cross/bin/x86_64-linux-musl-g++\" "
2020-11-04 11:41:52 +00:00
fi
2023-05-16 07:51:29 +00:00
CMD+="./configure --disable-mpers --host=$(get_host_triple)"
2020-11-04 11:41:52 +00:00
eval "$CMD"
make CFLAGS="-w" -j4
2023-05-16 07:51:29 +00:00
strip "${BUILD_DIRECTORY}/strace/src/strace"
2020-11-04 11:41:52 +00:00
}
main() {
build_strace
local version
2023-05-16 07:51:29 +00:00
version=$(get_version "${BUILD_DIRECTORY}/strace/src/strace -V 2>&1 | head -n1 | awk '{print \$4}'")
version_number=$(echo "$version" | cut -d"-" -f2)
cp "${BUILD_DIRECTORY}/strace/src/strace" "${OUTPUT_DIRECTORY}/strace${version}"
2020-11-04 11:41:52 +00:00
echo "[+] Finished building strace ${CURRENT_ARCH}"
echo ::set-output name=PACKAGED_NAME::"strace${version}"
echo ::set-output name=PACKAGED_NAME_PATH::"${OUTPUT_DIRECTORY}/*"
2023-05-16 07:51:29 +00:00
echo ::set-output name=PACKAGED_VERSION::"${version_number}"
2020-11-04 11:41:52 +00:00
}
main