Template
1
0
mirror of https://github.com/bol-van/zapret2.git synced 2026-03-14 06:13:09 +00:00

update builder-linux

This commit is contained in:
bol-van
2026-02-26 20:03:50 +03:00
parent c10cc5b83e
commit c634fd156c
3 changed files with 19 additions and 10 deletions

View File

@@ -89,9 +89,10 @@ dl_deps
check_toolchains
ask_target
CFLAGS="$CFLAGS $CFLAGS_PIC"
CFLAGS_BASE="$CFLAGS"
for t in $TGT; do
buildenv $t
CFLAGS="$CFLAGS_BASE $CFLAGS_PIC"
pushd "$DEPS"
install_h_files
build_netlink

View File

@@ -61,7 +61,7 @@ for t in $TGT; do
MINSIZE=$MINSIZE \
CFLAGS="-static-libgcc -I$STAGING_DIR/include $CFLAGS" \
LDFLAGS="-L$STAGING_DIR/lib $LDFLAGS" \
make CFLAGS_PIC=$CFLAGS_PIC LDFLAGS_PIE=$LDFLAGS_PIE LUA_JIT=$LJIT LUA_CFLAGS="$LCFLAGS" LUA_LIB="$LLIB"
make CFLAGS_PIC="$CFLAGS_PIC" LDFLAGS_PIE="$LDFLAGS_PIE" LUA_JIT=$LJIT LUA_CFLAGS="$LCFLAGS" LUA_LIB="$LLIB"
[ -d "$ZBIN/$ZBINTARGET" ] || mkdir "$ZBIN/$ZBINTARGET"
cp -f binaries/my/* "$ZBIN/$ZBINTARGET"

View File

@@ -5,11 +5,13 @@ TOOLCHAINS="$EXEDIR/toolchain"
DEPS="$EXEDIR/deps"
STAGE="$EXEDIR/staging"
OPTIMIZE=${OPTIMIZE:--Oz}
MINSIZE="${MINSIZE:--flto=auto -ffunction-sections -fdata-sections}"
#MINSIZE="${MINSIZE:--flto=auto -ffunction-sections -fdata-sections}"
MINSIZE="${MINSIZE:--ffunction-sections -fdata-sections}"
LDMINSIZE="${LDMINSIZE:--Wl,--gc-sections -flto=auto}"
#CFLAGS=""
LDFLAGS="-lgcc_eh $LDFLAGS"
# PIE makes ASLR working but adds 5% to size
# PIE does not work for arm32 and all mips
PIE=${PIE:-0}
HOSTCC=${HOSTCC:-cc}
LUA_VER=${LUA_VER:-5.5}
@@ -19,13 +21,6 @@ LUAJIT_RELEASE=${LUAJIT_RELEASE:-2.1-20250826}
LUAJIT_LUA_VER=${LUAJIT_LUA_VER:-5.1}
nproc=$(nproc)
CFLAGS_PIC=
LDFLAGS_PIE=-static
[ "$PIE" = 1 ] && {
CFLAGS_PIC=-fPIC
LDFLAGS_PIE=-static-pie
}
TARGETS="\
aarch64-unknown-linux-musl \
arm-unknown-linux-musleabi \
@@ -98,7 +93,20 @@ buildenv()
export PKG_CONFIG_PATH=$STAGING_DIR/lib/pkgconfig
OLDPATH="$PATH"
export PATH="$PATH:$TOOLCHAINS/$TARGET/bin"
CFLAGS_PIC=
LDFLAGS_PIE=-static
# not all archs support -static-pie. if does not support - it produces dynamic executable
# "-static -static-pie" causes segfaults
[ "$PIE" = 1 ] && case $1 in
arm-*|mips*)
;;
*)
CFLAGS_PIC=-fPIC
LDFLAGS_PIE="-static-pie"
esac
}
buildenv_clear()
{
export PATH="$OLDPATH" TARGET= CC= LD= AR= NM= STRIP= STAGING_DIR= PKG_CONFIG_PATH=