Added GitHub Actions and updated build framework
This commit is contained in:
parent
1f9bc44c60
commit
2e95cb4f0f
23 changed files with 1065 additions and 31 deletions
110
build/targets/build_gdb.sh
Executable file
110
build/targets/build_gdb.sh
Executable file
|
@ -0,0 +1,110 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
set -o pipefail
|
||||
set -x
|
||||
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_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 checkout binutils-2_35-branch
|
||||
#git clean -fdx
|
||||
|
||||
cd "${BUILD_DIRECTORY}/binutils-gdb/bfd"
|
||||
CC="gcc ${GCC_OPTS}" \
|
||||
CXX="g++ ${GXX_OPTS}" \
|
||||
./configure \
|
||||
--host="$(get_host_triple)" \
|
||||
--disable-shared \
|
||||
--enable-static
|
||||
make -j4
|
||||
|
||||
cd "${BUILD_DIRECTORY}/binutils-gdb/readline"
|
||||
CC="gcc ${GCC_OPTS}" \
|
||||
CXX="g++ ${GXX_OPTS}" \
|
||||
./configure \
|
||||
--host="$(get_host_triple)" \
|
||||
--disable-shared \
|
||||
--enable-static
|
||||
make -j4
|
||||
|
||||
cd "${BUILD_DIRECTORY}/binutils-gdb/opcodes"
|
||||
CC="gcc ${GCC_OPTS}" \
|
||||
CXX="g++ ${GXX_OPTS}" \
|
||||
./configure \
|
||||
--host="$(get_host_triple)" \
|
||||
--disable-shared \
|
||||
--enable-static
|
||||
make -j4
|
||||
|
||||
cd "${BUILD_DIRECTORY}/binutils-gdb/libiberty"
|
||||
CC="gcc ${GCC_OPTS}" \
|
||||
CXX="g++ ${GXX_OPTS}" \
|
||||
./configure \
|
||||
--host="$(get_host_triple)" \
|
||||
--disable-shared \
|
||||
--enable-static
|
||||
make -j4
|
||||
|
||||
cd "${BUILD_DIRECTORY}/binutils-gdb/libdecnumber"
|
||||
CC="gcc ${GCC_OPTS}" \
|
||||
CXX="g++ ${GXX_OPTS}" \
|
||||
./configure \
|
||||
--host="$(get_host_triple)" \
|
||||
--disable-shared \
|
||||
--enable-static
|
||||
make -j4
|
||||
|
||||
cd "${BUILD_DIRECTORY}/binutils-gdb/zlib"
|
||||
CC="gcc ${GCC_OPTS}" \
|
||||
CXX="g++ ${GXX_OPTS}" \
|
||||
/bin/bash ./configure \
|
||||
--host="$(get_host_triple)" \
|
||||
--enable-static
|
||||
make -j4
|
||||
|
||||
cd "${BUILD_DIRECTORY}/binutils-gdb/gdb"
|
||||
CC="gcc ${GCC_OPTS}" \
|
||||
CXX="g++ ${GXX_OPTS}" \
|
||||
./configure \
|
||||
--enable-static=yes \
|
||||
--host="$(get_host_triple)" \
|
||||
--disable-interprocess-agent
|
||||
make -j4
|
||||
|
||||
cd "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdbserver"
|
||||
CC="gcc ${GCC_OPTS}" \
|
||||
CXX="g++ ${GXX_OPTS}" \
|
||||
./configure \
|
||||
--enable-static=yes \
|
||||
--host="$(get_host_triple)" \
|
||||
--disable-interprocess-agent
|
||||
make -j4
|
||||
|
||||
strip "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdb" "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdbserver/gdbserver"
|
||||
}
|
||||
|
||||
main() {
|
||||
build_gdb
|
||||
if [ ! -f "${BUILD_DIRECTORY}/binutils-gdb/gdb/gdb" -o \
|
||||
! -f "${BUILD_DIRECTORY}/binutils-gdb/gdb/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}"
|
||||
echo "[+] Finished building GDB ${CURRENT_ARCH}"
|
||||
|
||||
echo ::set-output name=PACKAGED_NAME::"gdb${GDB_VERSION}"
|
||||
echo ::set-output name=PACKAGED_NAME_PATH::"/output/*"
|
||||
}
|
||||
|
||||
main
|
70
build/targets/build_nmap.sh
Executable file
70
build/targets/build_nmap.sh
Executable file
|
@ -0,0 +1,70 @@
|
|||
#!/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_nmap() {
|
||||
fetch "https://github.com/nmap/nmap.git" "${BUILD_DIRECTORY}/nmap" git
|
||||
cd "${BUILD_DIRECTORY}/nmap"
|
||||
git clean -fdx || true
|
||||
# make sure we only build the static libraries
|
||||
sed -i '/build-zlib: $(ZLIBDIR)\/Makefile/!b;n;c\\t@echo Compiling zlib; cd $(ZLIBDIR) && $(MAKE) static;' "${BUILD_DIRECTORY}/nmap/Makefile.in"
|
||||
CC='gcc -static -fPIC' \
|
||||
CXX='g++ -static -static-libstdc++ -fPIC' \
|
||||
LD=ld \
|
||||
LDFLAGS="-L/build/openssl" \
|
||||
./configure \
|
||||
--host="$(get_host_triple)" \
|
||||
--without-ndiff \
|
||||
--without-zenmap \
|
||||
--without-nmap-update \
|
||||
--without-libssh2 \
|
||||
--with-pcap=linux \
|
||||
--with-openssl="${BUILD_DIRECTORY}/openssl"
|
||||
sed -i -e "s/shared\: /shared\: #/" "${BUILD_DIRECTORY}/nmap/libpcap/Makefile"
|
||||
make
|
||||
strip nmap ncat/ncat nping/nping
|
||||
}
|
||||
|
||||
main() {
|
||||
lib_build_openssl
|
||||
build_nmap
|
||||
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
|
||||
VERSION_CMD=$(get_version "${BUILD_DIRECTORY}/nmap/nmap --version")
|
||||
NMAP_VERSION=$(echo "$VERSION_CMD" | grep "Nmap version" | awk '{print $3}')
|
||||
if [ -n "$NMAP_VERSION" ];then
|
||||
NMAP_VERSION="-${NMAP_VERSION}"
|
||||
fi
|
||||
cp "${BUILD_DIRECTORY}/nmap/nmap" "${OUTPUT_DIRECTORY}/nmap${NMAP_VERSION}"
|
||||
cp "${BUILD_DIRECTORY}/nmap/ncat/ncat" "${OUTPUT_DIRECTORY}/ncat${NMAP_VERSION}"
|
||||
cp "${BUILD_DIRECTORY}/nmap/nping/nping" "${OUTPUT_DIRECTORY}/nping${NMAP_VERSION}"
|
||||
echo "[+] Finished building Nmap ${CURRENT_ARCH}"
|
||||
NMAP_COMMIT=$(cd "${BUILD_DIRECTORY}/nmap/" && git rev-parse --short HEAD)
|
||||
NMAP_DIR="${OUTPUT_DIRECTORY}/nmap-data${NMAP_VERSION}-${NMAP_COMMIT}"
|
||||
if [ ! -d "$NMAP_DIR" ];then
|
||||
echo "[-] ${NMAP_DIR} does not exist, creating it"
|
||||
mkdir -p "${NMAP_DIR}"
|
||||
fi
|
||||
if [ -n "$(ls $NMAP_DIR)" ];then
|
||||
echo "[+] Data directory is not empty"
|
||||
exit
|
||||
fi
|
||||
cd "${BUILD_DIRECTORY}/nmap"
|
||||
make install
|
||||
cp -r /usr/local/share/nmap/* $NMAP_DIR
|
||||
echo "[+] Copied data to Nmap data dir"
|
||||
}
|
||||
|
||||
main
|
51
build/targets/build_openssh.sh
Executable file
51
build/targets/build_openssh.sh
Executable file
|
@ -0,0 +1,51 @@
|
|||
#!/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_openssh() {
|
||||
fetch "https://github.com/openssh/openssh-portable.git" "${BUILD_DIRECTORY}/openssh-portable" git
|
||||
cd "${BUILD_DIRECTORY}/openssh-portable"
|
||||
git checkout V_7_9
|
||||
git clean -fdx
|
||||
autoreconf -i
|
||||
CC="gcc ${GCC_OPTS}" \
|
||||
CXX="g++ ${GXX_OPTS}" \
|
||||
CXXFLAGS="-I${BUILD_DIRECTORY}/openssl -I${BUILD_DIRECTORY}/binutils-gdb/zlib" \
|
||||
./configure \
|
||||
--with-ssl-engine \
|
||||
--with-ssl-dir="${BUILD_DIRECTORY}/openssl" \
|
||||
--with-zlib="${BUILD_DIRECTORY}/binutils-gdb/zlib" \
|
||||
--with-ldflags=-static \
|
||||
--host="$(get_host_triple)"
|
||||
make -j4
|
||||
strip ssh sshd
|
||||
}
|
||||
|
||||
main() {
|
||||
lib_build_openssl
|
||||
lib_build_zlib
|
||||
build_openssh
|
||||
if [ ! -f "${BUILD_DIRECTORY}/openssh-portable/ssh" -o \
|
||||
! -f "${BUILD_DIRECTORY}/openssh-portable/sshd" ];then
|
||||
echo "[-] Building OpenSSH ${CURRENT_ARCH} failed!"
|
||||
exit 1
|
||||
fi
|
||||
OPENSSH_VERSION=$(get_version "${BUILD_DIRECTORY}/openssh-portable/ssh -V 2>&1 | awk '{print \$1}' | sed 's/,//g'")
|
||||
cp "${BUILD_DIRECTORY}/openssh-portable/ssh" "${OUTPUT_DIRECTORY}/ssh${OPENSSH_VERSION}"
|
||||
cp "${BUILD_DIRECTORY}/openssh-portable/sshd" "${OUTPUT_DIRECTORY}/sshd${OPENSSH_VERSION}"
|
||||
echo "[+] Finished building OpenSSH ${CURRENT_ARCH}"
|
||||
|
||||
OPENSSH_VERSION=$(echo $OPENSSH_VERSION | sed 's/-//')
|
||||
echo ::set-output name=PACKAGED_NAME::"${OPENSSH_VERSION}"
|
||||
echo ::set-output name=PACKAGED_NAME_PATH::"/output/*"
|
||||
}
|
||||
|
||||
main
|
43
build/targets/build_socat.sh
Executable file
43
build/targets/build_socat.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_socat() {
|
||||
fetch "http://repo.or.cz/socat.git" "${BUILD_DIRECTORY}/socat" git
|
||||
cd "${BUILD_DIRECTORY}/socat"
|
||||
git clean -fdx
|
||||
autoconf
|
||||
CFLAGS="${GCC_OPTS}" \
|
||||
CXXFLAGS="${GXX_OPTS}" \
|
||||
CPPFLAGS="-I${BUILD_DIRECTORY} -I${BUILD_DIRECTORY}/openssl/include -DNETDB_INTERNAL=-1" \
|
||||
LDFLAGS="-L${BUILD_DIRECTORY}/readline -L${BUILD_DIRECTORY}/ncurses/lib -L${BUILD_DIRECTORY}/openssl" \
|
||||
./configure \
|
||||
--host="$(get_host_triple)"
|
||||
make -j4
|
||||
strip socat
|
||||
}
|
||||
|
||||
main() {
|
||||
#sudo apt install yodl
|
||||
lib_build_openssl
|
||||
lib_build_ncurses
|
||||
lib_build_readline
|
||||
build_socat
|
||||
local version
|
||||
version=$(get_version "${BUILD_DIRECTORY}/socat/socat -V | grep 'socat version' | awk '{print \$3}'")
|
||||
cp "${BUILD_DIRECTORY}/socat/socat" "${OUTPUT_DIRECTORY}/socat${version}"
|
||||
echo "[+] Finished building socat ${CURRENT_ARCH}"
|
||||
|
||||
echo ::set-output name=PACKAGED_NAME::"socat${version}"
|
||||
echo ::set-output name=PACKAGED_NAME_PATH::"${OUTPUT_DIRECTORY}/*"
|
||||
}
|
||||
|
||||
main
|
Loading…
Add table
Add a link
Reference in a new issue