Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use exported STRIP to strip binaries #77

Merged
merged 2 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion azure_sdk/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ install_binary () {
BINARY_NAME="$(basename "$1")"

cp "$1" "${PREFIX_PROG}"
"${CROSS}strip" -s "${PREFIX_PROG}/${BINARY_NAME}" -o "$PREFIX_PROG_STRIPPED/${BINARY_NAME}"
$STRIP "${PREFIX_PROG}/${BINARY_NAME}" -o "$PREFIX_PROG_STRIPPED/${BINARY_NAME}"
b_install "${PREFIX_PROG_STRIPPED}/${BINARY_NAME}" /bin
}

Expand Down
5 changes: 3 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ else
fi
export HOST_TARGET HOST

# use CFLAGS/LDFLAGS taken from make
# use CFLAGS/LDFLAGS/STRIP taken from make
CFLAGS="$EXPORT_CFLAGS"
LDFLAGS="$EXPORT_LDFLAGS"
export CFLAGS LDFLAGS
STRIP="$EXPORT_STRIP"
export CFLAGS LDFLAGS STRIP


if [ -n "$PORTS_INSTALL_STRIPPED" ] && [ "$PORTS_INSTALL_STRIPPED" = "n" ]; then
Expand Down
6 changes: 4 additions & 2 deletions coremark/01-core_portme.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ diff --git a/posix/core_portme.mak b/posix/core_portme.mak
index 2852069..3eaaabe 100755
--- a/posix/core_portme.mak
+++ b/posix/core_portme.mak
@@ -24,8 +24,12 @@ OUTFLAG= -o
@@ -24,8 +24,14 @@ OUTFLAG= -o
CC?= cc
# Flag: CFLAGS
# Use this flag to define compiler options. Note, you can add compiler options from the command line using XCFLAGS="other flags"
-PORT_CFLAGS = -O2
-FLAGS_STR = "$(PORT_CFLAGS) $(XCFLAGS) $(XLFLAGS) $(LFLAGS_END)"
+PORT_CFLAGS =
+# FLAGS_STR is used to define string of used flags for the test
+# Filter out some flags that are not necessary to print in benchmark output
+FLAGS_STR := $(filter-out -I%,$(PORT_CFLAGS) $(XCFLAGS) $(XLFLAGS) $(LFLAGS_END))
+FLAGS_STR := $(filter-out --sysroot=%,$(FLAGS_STR))
+FLAGS_STR := $(filter-out -B%,$(FLAGS_STR))
Expand All @@ -17,7 +19,7 @@ index 2852069..3eaaabe 100755
CFLAGS = $(PORT_CFLAGS) -I$(PORT_DIR) -Iposix -I. -DFLAGS_STR=\"$(FLAGS_STR)\"
# Flag: NO_LIBRT
# Define if the platform does not provide a librt
@@ -65,7 +69,7 @@ LOAD = echo Loading done
@@ -65,7 +71,7 @@ LOAD = echo Loading done
RUN =

OEXT = .o
Expand Down
5 changes: 2 additions & 3 deletions coremark/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ if [ -z ${PORTS_COREMARK_THREADS+x} ]; then
PORTS_COREMARK_THREADS="1"
fi

export XCFLAGS="${CFLAGS} -DUSE_PTHREAD -DMULTITHREAD=${PORTS_COREMARK_THREADS}"
export XLFLAGS="${LDFLAGS}"
export XCFLAGS="${CFLAGS} -DUSE_PTHREAD -DMULTITHREAD=${PORTS_COREMARK_THREADS} ${LDFLAGS}"
lukileczo marked this conversation as resolved.
Show resolved Hide resolved

# Build coremark
PORT_DIR=phoenix make compile

cp -a "$PREFIX_COREMARK_BUILD/${COREMARK}/coremark" "$PREFIX_PROG/coremark"
"${CROSS}strip" -s "${PREFIX_PROG}/coremark" -o "${PREFIX_PROG_STRIPPED}/coremark"
$STRIP -s "${PREFIX_PROG}/coremark" -o "${PREFIX_PROG_STRIPPED}/coremark"
b_install "$PREFIX_PORTS_INSTALL/coremark" /bin
2 changes: 1 addition & 1 deletion curl/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ make -C "$PREFIX_CURL_BUILD" install
cp -a "$PREFIX_CURL_INSTALL/include/curl" "$PREFIX_H"
cp -a "$PREFIX_CURL_INSTALL/lib/"* "$PREFIX_A"
cp -a "$PREFIX_CURL_INSTALL/bin/curl" "$PREFIX_PROG/curl"
"${CROSS}strip" -s "$PREFIX_PROG/curl" -o "$PREFIX_PROG_STRIPPED/curl"
$STRIP -s "$PREFIX_PROG/curl" -o "$PREFIX_PROG_STRIPPED/curl"
b_install "$PREFIX_PORTS_INSTALL/curl" /usr/bin/
2 changes: 1 addition & 1 deletion dropbear/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
export OLDCFLAGS="-v" # HACKISH: fix ./configure script not detecting externally-provided CFLAGS

( cd "${PREFIX_DROPBEAR_BUILD}" && "${PREFIX_DROPBEAR_SRC}/configure" CFLAGS="${CFLAGS} ${DROPBEAR_CFLAGS}" \
LDFLAGS="${CFLAGS} ${LDFLAGS} ${DROPBEAR_LDFLAGS}" ARFLAGS="-r" \

Check warning on line 49 in dropbear/build.sh

View workflow job for this annotation

GitHub Actions / call-lint / shellcheck-pr

[shellcheck] reported by reviewdog 🐶 Possible misspelling: LDFLAGS may not be assigned. Did you mean OLDCFLAGS? [SC2153](https://github.com/koalaman/shellcheck/wiki/SC2153) Raw Output: ./dropbear/build.sh:49:36:info:Possible misspelling: LDFLAGS may not be assigned. Did you mean OLDCFLAGS? [SC2153](https://github.com/koalaman/shellcheck/wiki/SC2153)
--host="${HOST}" --includedir="${PREFIX_H}" \
--prefix="${PREFIX_PROG}" --program-prefix="${PREFIX_PROG}" --libdir="${PREFIX_A}" --bindir="${PREFIX_PROG}" --enable-zlib="$ENABLE_ZLIB" --enable-static \
--disable-lastlog --disable-utmp --disable-utmpx --disable-wtmp --disable-wtmpx --disable-harden )
Expand All @@ -58,7 +58,7 @@
# create multi-binary and hardlinks
make PROGRAMS="dropbear dbclient dropbearkey scp" -C "${PREFIX_DROPBEAR_BUILD}" CROSS_COMPILE="$CROSS" MULTI=1 NO_ADDTL_WARNINGS=1

"${CROSS}strip" -s "$PREFIX_DROPBEAR_BUILD/dropbearmulti" -o "$PREFIX_PROG_STRIPPED/dropbearmulti"
$STRIP -s "$PREFIX_DROPBEAR_BUILD/dropbearmulti" -o "$PREFIX_PROG_STRIPPED/dropbearmulti"
cp -a "$PREFIX_DROPBEAR_BUILD/dropbearmulti" "$PREFIX_PROG/dropbearmulti"

b_install "$PREFIX_PORTS_INSTALL/dropbearmulti" /usr/bin
Expand Down
2 changes: 1 addition & 1 deletion fs_mark/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ done
cd "${PREFIX_FS_MARK_BUILD}/${FS_MARK}" && make

cp -a "$PREFIX_FS_MARK_BUILD/${FS_MARK}/fs_mark" "$PREFIX_PROG/fs_mark"
"${CROSS}strip" -s "${PREFIX_PROG}/fs_mark" -o "${PREFIX_PROG_STRIPPED}/fs_mark"
$STRIP -s "${PREFIX_PROG}/fs_mark" -o "${PREFIX_PROG_STRIPPED}/fs_mark"
b_install "$PREFIX_PORTS_INSTALL/fs_mark" /bin
2 changes: 1 addition & 1 deletion lighttpd/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ fi

make -C "${PREFIX_LIGHTTPD_BUILD}" install

"${CROSS}strip" -s "$PREFIX_PROG/lighttpd" -o "$PREFIX_PROG_STRIPPED/lighttpd"
$STRIP -s "$PREFIX_PROG/lighttpd" -o "$PREFIX_PROG_STRIPPED/lighttpd"
b_install "$PREFIX_PORTS_INSTALL/lighttpd" /usr/sbin
4 changes: 2 additions & 2 deletions lua/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ fi
# FIXME: no out-of-tree building
make -C "$PREFIX_LUA_SRC" posix

"${CROSS}strip" -s "$PREFIX_LUA_SRC/src/lua" -o "$PREFIX_PROG_STRIPPED/lua"
"${CROSS}strip" -s "$PREFIX_LUA_SRC/src/luac" -o "$PREFIX_PROG_STRIPPED/luac"
$STRIP -s "$PREFIX_LUA_SRC/src/lua" -o "$PREFIX_PROG_STRIPPED/lua"
$STRIP -s "$PREFIX_LUA_SRC/src/luac" -o "$PREFIX_PROG_STRIPPED/luac"
cp -a "$PREFIX_LUA_SRC/src/lua" "$PREFIX_PROG/lua"
cp -a "$PREFIX_LUA_SRC/src/luac" "$PREFIX_PROG/luac"

Expand Down
2 changes: 2 additions & 0 deletions micropython/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ fi
#
# Architecture specific flags/values set
#

# TODO: use strip manually
if [ "${TARGET_FAMILY}" = "armv7m7" ]; then
STRIPEXP="--strip-unneeded"
elif [ "${TARGET_FAMILY}" = "ia32" ]; then
Expand Down
4 changes: 2 additions & 2 deletions openiked/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ popd

cp -a "${PREFIX_OPENIKED_INSTALL}/usr/local/sbin/ikectl" "${PREFIX_PROG}/ikectl"
cp -a "${PREFIX_OPENIKED_INSTALL}/usr/local/sbin/iked" "${PREFIX_PROG}/iked"
"${CROSS}strip" -s "${PREFIX_PROG}/ikectl" -o "${PREFIX_PROG_STRIPPED}/ikectl"
"${CROSS}strip" -s "${PREFIX_PROG}/iked" -o "${PREFIX_PROG_STRIPPED}/iked"
$STRIP -s "${PREFIX_PROG}/ikectl" -o "${PREFIX_PROG_STRIPPED}/ikectl"
$STRIP -s "${PREFIX_PROG}/iked" -o "${PREFIX_PROG_STRIPPED}/iked"
b_install "${PREFIX_PORTS_INSTALL}/ikectl" /usr/bin
b_install "${PREFIX_PORTS_INSTALL}/iked" /usr/bin
2 changes: 1 addition & 1 deletion openssl/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ cp -a "$PREFIX_OPENSSL_INSTALL/lib/pkgconfig" "$PREFIX_A"
sed -i "s/openssl\/install$/lib\/pkgconfg/" "$PREFIX_A/pkgconfig/"*

cp -a "$PREFIX_OPENSSL_INSTALL/bin/openssl" "$PREFIX_PROG"
"${CROSS}strip" -s "$PREFIX_PROG/openssl" -o "$PREFIX_PROG_STRIPPED/openssl"
$STRIP -s "$PREFIX_PROG/openssl" -o "$PREFIX_PROG_STRIPPED/openssl"
b_install "$PREFIX_PORTS_INSTALL/openssl" /usr/bin/
2 changes: 1 addition & 1 deletion openvpn/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ fi
make -C "$PREFIX_OPENVPN_BUILD"
make -C "$PREFIX_OPENVPN_BUILD" install-exec

"${CROSS}strip" -s "$PREFIX_PROG/openvpn" -o "$PREFIX_PROG_STRIPPED/openvpn"
$STRIP -s "$PREFIX_PROG/openvpn" -o "$PREFIX_PROG_STRIPPED/openvpn"
b_install "$PREFIX_PORTS_INSTALL/openvpn" /sbin/
2 changes: 1 addition & 1 deletion picocom/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export LDFLAGS="${CFLAGS} $LDFLAGS"
#
(cd "${PREFIX_PCOM_SRC}" && make clean && make)
cp -a "${PREFIX_PCOM_SRC}/picocom" "$PREFIX_PROG"
lukileczo marked this conversation as resolved.
Show resolved Hide resolved
"${CROSS}strip" -s "${PREFIX_PROG}/picocom" -o "$PREFIX_PROG_STRIPPED/picocom"
$STRIP -s "${PREFIX_PROG}/picocom" -o "$PREFIX_PROG_STRIPPED/picocom"


b_install "${PREFIX_PROG_STRIPPED}/picocom" /bin
2 changes: 1 addition & 1 deletion sscep/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ make install DESTDIR="$PREFIX_SSCEP_INSTALL"
popd

cp -a "${PREFIX_SSCEP_INSTALL}/bin/sscep" "${PREFIX_PROG}/sscep"
"${CROSS}strip" -s "${PREFIX_PROG}/sscep" -o "${PREFIX_PROG_STRIPPED}/sscep"
$STRIP -s "${PREFIX_PROG}/sscep" -o "${PREFIX_PROG_STRIPPED}/sscep"
b_install "${PREFIX_PORTS_INSTALL}/sscep" /usr/bin
4 changes: 2 additions & 2 deletions wpa_supplicant/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ popd

cp -a "${PREFIX_WPA_SUPPLICANT_INSTALL}/bin/wpa_cli" "${PREFIX_PROG}/wpa_cli"
cp -a "${PREFIX_WPA_SUPPLICANT_INSTALL}/bin/wpa_supplicant" "${PREFIX_PROG}/wpa_supplicant"
"${CROSS}strip" -s "${PREFIX_PROG}/wpa_cli" -o "${PREFIX_PROG_STRIPPED}/wpa_cli"
"${CROSS}strip" -s "${PREFIX_PROG}/wpa_supplicant" -o "${PREFIX_PROG_STRIPPED}/wpa_supplicant"
$STRIP -s "${PREFIX_PROG}/wpa_cli" -o "${PREFIX_PROG_STRIPPED}/wpa_cli"
$STRIP -s "${PREFIX_PROG}/wpa_supplicant" -o "${PREFIX_PROG_STRIPPED}/wpa_supplicant"
b_install "${PREFIX_PORTS_INSTALL}/wpa_cli" /usr/bin
b_install "${PREFIX_PORTS_INSTALL}/wpa_supplicant" /usr/bin
Loading