Updated building framework
This commit is contained in:
parent
8449cf65b5
commit
4a9365f57a
8 changed files with 175 additions and 52 deletions
28
build/install_deps_alpine.sh
Executable file
28
build/install_deps_alpine.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
apk update
|
||||
apk add \
|
||||
bash \
|
||||
git \
|
||||
perl \
|
||||
make \
|
||||
cmake \
|
||||
flex \
|
||||
bison \
|
||||
automake \
|
||||
autoconf \
|
||||
libtool \
|
||||
qemu-arm \
|
||||
qemu-aarch64 \
|
||||
file \
|
||||
texinfo \
|
||||
zip \
|
||||
wget \
|
||||
coreutils \
|
||||
gawk \
|
||||
gmp-dev \
|
||||
libunistring-dev \
|
||||
libffi-dev \
|
||||
lttng-ust-dev \
|
||||
curl \
|
||||
rsync \
|
||||
util-linux
|
17
build/lib.sh
17
build/lib.sh
|
@ -40,13 +40,13 @@ set_http_proxy(){
|
|||
get_host_triple(){
|
||||
local host
|
||||
if [ "$CURRENT_ARCH" == "x86" ];then
|
||||
host="i486-linux-musl"
|
||||
host="i686-linux-musl"
|
||||
elif [ "$CURRENT_ARCH" == "x86_64" ];then
|
||||
host="x86_64-unknown-linux-musl"
|
||||
host="x86_64-linux-musl"
|
||||
elif [ "$CURRENT_ARCH" == "armhf" ];then
|
||||
host="arm-linux-musleabihf"
|
||||
elif [ "$CURRENT_ARCH" == "aarch64" ];then
|
||||
host="aarch64-linux-musleabi"
|
||||
host="aarch64-linux-musl"
|
||||
fi
|
||||
echo $host
|
||||
}
|
||||
|
@ -157,23 +157,20 @@ get_version(){
|
|||
}
|
||||
|
||||
lib_create_tmp_dir(){
|
||||
local tmp_dir
|
||||
tmp_dir=$(mktemp -dt -p "${TMP_DIR}" tmpdir.XXXXXX)
|
||||
local tmp_dir=$(mktemp -dt -p ${TMP_DIR} tmpdir.XXXXXX)
|
||||
echo "$tmp_dir"
|
||||
}
|
||||
|
||||
lib_check_lib_arch(){
|
||||
lib=$1
|
||||
local tmp_dir
|
||||
local output
|
||||
if [ ! -f "$lib" ];then
|
||||
echo ""
|
||||
return
|
||||
fi
|
||||
tmp_dir=$(lib_create_tmp_dir)
|
||||
local tmp_dir=$(lib_create_tmp_dir)
|
||||
cp "$lib" "$tmp_dir"
|
||||
bash -c "cd ${tmp_dir}; ar x $(basename ${lib})"
|
||||
output=$(find "${tmp_dir}" -name "*.o" -exec file {} \;)
|
||||
local output=$(find "${tmp_dir}" -name "*.o" -exec file {} \;)
|
||||
if echo "$output" | grep -q "Intel 80386";then
|
||||
echo "Arch of ${lib} is x86" >&2
|
||||
echo "x86"
|
||||
|
@ -262,7 +259,7 @@ lib_build_ncurses(){
|
|||
CMD="CFLAGS=\"${GCC_OPTS}\" "
|
||||
CMD+="CXXFLAGS=\"${GXX_OPTS}\" "
|
||||
CMD+="./configure --host=$(get_host_triple) --disable-shared --enable-static"
|
||||
if [ "$CURRENT_ARCH" != "x86" ] && [ "$CURRENT_ARCH" != "x86_64" ];then
|
||||
if [ "$CURRENT_ARCH"!="x86" -a "$CURRENT_ARCH"!="x86_64" ];then
|
||||
CMD+=" --with-build-cc=/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc"
|
||||
fi
|
||||
eval "$CMD"
|
||||
|
|
|
@ -14,57 +14,37 @@ build_gdb() {
|
|||
fetch "$GIT_BINUTILS_GDB" "${BUILD_DIRECTORY}/binutils-gdb" git
|
||||
cd "${BUILD_DIRECTORY}/binutils-gdb/" || { echo "Cannot cd to ${BUILD_DIRECTORY}/binutils-gdb/"; exit 1; }
|
||||
git clean -fdx
|
||||
git checkout gdb-9.2-release
|
||||
git checkout gdb-10.1-release
|
||||
|
||||
CMD="CFLAGS=\"${GCC_OPTS}\" "
|
||||
CMD+="CXXFLAGS=\"${GXX_OPTS}\" "
|
||||
CMD+="LDFLAGS=\"-static -pthread\" "
|
||||
if [ "$CURRENT_ARCH" != "x86" ] && [ "$CURRENT_ARCH" != "x86_64" ];then
|
||||
CMD+="LDFLAGS=\"-static\" "
|
||||
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++\" "
|
||||
fi
|
||||
CMD+="${BUILD_DIRECTORY}/binutils-gdb/configure --target=$(get_host_triple) --host=x86_64-unknown-linux-musl "
|
||||
CMD+="--disable-shared --enable-static"
|
||||
CMD+="${BUILD_DIRECTORY}/binutils-gdb/configure --build=x86_64-linux-musl --host=$(get_host_triple) "
|
||||
CMD+="--disable-shared --enable-static --enable-gdbserver --disable-nls"
|
||||
|
||||
GDB_CMD="${CMD} --disable-interprocess-agent"
|
||||
|
||||
cd "${BUILD_DIRECTORY}/binutils-gdb/"
|
||||
mkdir build
|
||||
cd build
|
||||
eval "$GDB_CMD"
|
||||
ls -la
|
||||
|
||||
cd "${BUILD_DIRECTORY}/binutils-gdb/"
|
||||
MAKE_PROG="${MAKE-make}"
|
||||
MAKE="${MAKE_PROG} AR=true LINK=true"
|
||||
export MAKE
|
||||
${MAKE} $* all-libiberty
|
||||
${MAKE} $* all-intl
|
||||
${MAKE} $* all-bfd
|
||||
cd binutils
|
||||
MAKE="${MAKE_PROG}"
|
||||
export MAKE
|
||||
${MAKE} $* ar_DEPENDENCIES= ar_LDADD='../bfd/*.o ../libiberty/*.o `if test -f ../intl/gettext.o; then echo '../intl/*.o'; fi`' ar
|
||||
ls -la
|
||||
cp ar /usr/bin
|
||||
|
||||
cd "${BUILD_DIRECTORY}/binutils-gdb/build"
|
||||
mkdir -p "${BUILD_DIRECTORY}/gdb_build"
|
||||
cd "${BUILD_DIRECTORY}/gdb_build/"
|
||||
eval "$CMD"
|
||||
make -j4
|
||||
|
||||
strip "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdb" "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdbserver/gdbserver"
|
||||
strip "${BUILD_DIRECTORY}/gdb_build/gdb/gdb" "${BUILD_DIRECTORY}/gdb_build/gdbserver/gdbserver"
|
||||
}
|
||||
|
||||
main() {
|
||||
build_gdb
|
||||
if [ ! -f "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdb" ] || \
|
||||
[ ! -f "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdbserver/gdbserver" ];then
|
||||
if [ ! -f "${BUILD_DIRECTORY}/gdb_build/gdb/gdb" ] || \
|
||||
[ ! -f "${BUILD_DIRECTORY}/gdb_build/gdbserver/gdbserver" ];then
|
||||
echo "[-] Building GDB ${CURRENT_ARCH} failed!"
|
||||
exit 1
|
||||
fi
|
||||
GDB_VERSION=$(get_version "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdb --version |head -n1 |awk '{print \$4}'")
|
||||
GDBSERVER_VERSION=$(get_version "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdbserver/gdbserver --version |head -n1 |awk '{print \$4}'")
|
||||
cp "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdb" "${OUTPUT_DIRECTORY}/gdb${GDB_VERSION}"
|
||||
cp "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdbserver/gdbserver" "${OUTPUT_DIRECTORY}/gdbserver${GDBSERVER_VERSION}"
|
||||
GDB_VERSION=$(get_version "${BUILD_DIRECTORY}/gdb_build/gdb/gdb --version |head -n1 |awk '{print \$4}'")
|
||||
GDBSERVER_VERSION=$(get_version "${BUILD_DIRECTORY}/gdb_build/gdbserver/gdbserver --version |head -n1 |awk '{print \$4}'")
|
||||
cp "${BUILD_DIRECTORY}/gdb_build/gdb/gdb" "${OUTPUT_DIRECTORY}/gdb${GDB_VERSION}"
|
||||
cp "${BUILD_DIRECTORY}/gdb_build/gdbserver/gdbserver" "${OUTPUT_DIRECTORY}/gdbserver${GDBSERVER_VERSION}"
|
||||
echo "[+] Finished building GDB ${CURRENT_ARCH}"
|
||||
|
||||
echo ::set-output name=PACKAGED_NAME::"gdb${GDB_VERSION}"
|
||||
|
|
|
@ -36,9 +36,9 @@ build_nmap() {
|
|||
main() {
|
||||
lib_build_openssl
|
||||
build_nmap
|
||||
if [ ! -f "${BUILD_DIRECTORY}/nmap/nmap" ] || \
|
||||
[ ! -f "${BUILD_DIRECTORY}/nmap/ncat/ncat" ] || \
|
||||
[ ! -f "${BUILD_DIRECTORY}/nmap/nping/nping" ];then
|
||||
if [ ! -f "${BUILD_DIRECTORY}/nmap/nmap" -o \
|
||||
! -f "${BUILD_DIRECTORY}/nmap/ncat/ncat" -o \
|
||||
! -f "${BUILD_DIRECTORY}/nmap/nping/nping" ];then
|
||||
echo "[-] Building Nmap ${CURRENT_ARCH} failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -63,7 +63,7 @@ main() {
|
|||
fi
|
||||
cd "${BUILD_DIRECTORY}/nmap"
|
||||
make install
|
||||
cp -r /usr/local/share/nmap/* "$NMAP_DIR"
|
||||
cp -r /usr/local/share/nmap/* $NMAP_DIR
|
||||
echo "[+] Copied data to Nmap data dir"
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ main() {
|
|||
lib_build_openssl
|
||||
lib_build_zlib
|
||||
build_openssh
|
||||
if [ ! -f "${BUILD_DIRECTORY}/openssh-portable/ssh" ] || \
|
||||
[ ! -f "${BUILD_DIRECTORY}/openssh-portable/sshd" ];then
|
||||
if [ ! -f "${BUILD_DIRECTORY}/openssh-portable/ssh" -o \
|
||||
! -f "${BUILD_DIRECTORY}/openssh-portable/sshd" ];then
|
||||
echo "[-] Building OpenSSH ${CURRENT_ARCH} failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -43,7 +43,7 @@ main() {
|
|||
cp "${BUILD_DIRECTORY}/openssh-portable/sshd" "${OUTPUT_DIRECTORY}/sshd${OPENSSH_VERSION}"
|
||||
echo "[+] Finished building OpenSSH ${CURRENT_ARCH}"
|
||||
|
||||
OPENSSH_VERSION=$(echo "$OPENSSH_VERSION" | sed 's/-//')
|
||||
OPENSSH_VERSION=$(echo $OPENSSH_VERSION | sed 's/-//')
|
||||
echo ::set-output name=PACKAGED_NAME::"${OPENSSH_VERSION}"
|
||||
echo ::set-output name=PACKAGED_NAME_PATH::"/output/*"
|
||||
}
|
||||
|
|
43
build/targets/build_strace.sh
Executable file
43
build/targets/build_strace.sh
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/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"
|
||||
|
||||
build_strace() {
|
||||
fetch "https://github.com/strace/strace" "${BUILD_DIRECTORY}/strace" git
|
||||
cd "${BUILD_DIRECTORY}/strace"
|
||||
git clean -fdx
|
||||
git checkout v5.7
|
||||
./bootstrap
|
||||
CMD="CFLAGS=\"${GCC_OPTS}\" "
|
||||
CMD+="CXXFLAGS=\"${GXX_OPTS}\" "
|
||||
CMD+="LDFLAGS=\"-static -pthread\" "
|
||||
if [ "$CURRENT_ARCH" != "x86" ] && [ "$CURRENT_ARCH" != "x86_64" ];then
|
||||
CMD+="CC_FOR_BUILD=\"/i686-linux-musl-cross/bin/i686-linux-musl-gcc\" "
|
||||
CMD+="CPP_FOR_BUILD=\"/i686-linux-musl-cross/bin/i686-linux-musl-g++\" "
|
||||
fi
|
||||
CMD+="./configure --host=i486-linux-musl --target=$(get_host_triple)"
|
||||
eval "$CMD"
|
||||
make CFLAGS="-w" -j4
|
||||
strip strace
|
||||
}
|
||||
|
||||
main() {
|
||||
build_strace
|
||||
local version
|
||||
version=$(get_version "${BUILD_DIRECTORY}/strace/strace --version 2>&1 | head -n1 | awk '{print \$4}'")
|
||||
cp "${BUILD_DIRECTORY}/strace/strace" "${OUTPUT_DIRECTORY}/strace"
|
||||
echo "[+] Finished building strace ${CURRENT_ARCH}"
|
||||
|
||||
echo ::set-output name=PACKAGED_NAME::"strace${version}"
|
||||
echo ::set-output name=PACKAGED_NAME_PATH::"${OUTPUT_DIRECTORY}/*"
|
||||
}
|
||||
|
||||
main
|
57
build/targets/build_tcpreplay.sh
Executable file
57
build/targets/build_tcpreplay.sh
Executable file
|
@ -0,0 +1,57 @@
|
|||
#!/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"
|
||||
|
||||
build_autogen(){
|
||||
fetch "http://ftp.gnu.org/gnu/autogen/rel5.16.2/autogen-5.16.2.tar.gz" "${BUILD_DIRECTORY}/autogen" http
|
||||
cd "${BUILD_DIRECTORY}/autogen"
|
||||
automake
|
||||
CFLAGS="${GCC_OPTS}" \
|
||||
CXXFLAGS="${GXX_OPTS}" \
|
||||
CPPFLAGS="-static" \
|
||||
LDFLAGS="-static" \
|
||||
./configure \
|
||||
--host="$(get_host_triple)"
|
||||
make -j4
|
||||
make install
|
||||
}
|
||||
|
||||
build_tcpreplay() {
|
||||
fetch "https://github.com/appneta/tcpreplay.git" "${BUILD_DIRECTORY}/tcpdump" git
|
||||
cd "${BUILD_DIRECTORY}/tcpreplay"
|
||||
git clean -fdx
|
||||
git checkout v4.3.3
|
||||
export LIBPCAP_PATH="${BUILD_DIRECTORY}/libpcap"
|
||||
./autogen.sh
|
||||
CFLAGS="${GCC_OPTS} -I${LIBPCAP_PATH} -L${LIBPCAP_PATH}" \
|
||||
CXXFLAGS="${GXX_OPTS}" \
|
||||
CPPFLAGS="-static" \
|
||||
LDFLAGS="-static" \
|
||||
./configure \
|
||||
--host="$(get_host_triple)"
|
||||
make -j4
|
||||
strip tcpreplay
|
||||
}
|
||||
|
||||
main() {
|
||||
lib_build_libpcap
|
||||
build_autogen
|
||||
build_tcpreplay
|
||||
local version
|
||||
version=$(get_version "${BUILD_DIRECTORY}/tcpreplay/tcpreplay --version 2>&1 | head -n1 | awk '{print \$3}'")
|
||||
cp "${BUILD_DIRECTORY}/tcpreplay/tcpreplay" "${OUTPUT_DIRECTORY}/tcpreplay"
|
||||
echo "[+] Finished building tcpreplay ${CURRENT_ARCH}"
|
||||
|
||||
echo ::set-output name=PACKAGED_NAME::"tcpreplay${version}"
|
||||
echo ::set-output name=PACKAGED_NAME_PATH::"${OUTPUT_DIRECTORY}/*"
|
||||
}
|
||||
|
||||
main
|
18
patches/gdb/gdb-aarch64-header-sigcontext-fix.patch
Normal file
18
patches/gdb/gdb-aarch64-header-sigcontext-fix.patch
Normal file
|
@ -0,0 +1,18 @@
|
|||
--- /tmp/aarch64-linux-musl-cross/aarch64-linux-musl/include/asm/sigcontext.h
|
||||
+++ /aarch64-linux-musl-cross/aarch64-linux-musl/include/asm/sigcontext.h
|
||||
@@ -25,6 +25,7 @@
|
||||
* Signal context structure - contains all info to do with the state
|
||||
* before the signal handler was invoked.
|
||||
*/
|
||||
+#if false
|
||||
struct sigcontext {
|
||||
__u64 fault_address;
|
||||
/* AArch64 registers */
|
||||
@@ -127,6 +128,7 @@
|
||||
__u16 vl;
|
||||
__u16 __reserved[3];
|
||||
};
|
||||
+#endif
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
Loading…
Reference in a new issue