Skip to content

Commit 1aaf3c2

Browse files
committed
Do not build test binaries statically in CI
For the CI runs intended to be testing static binary, only build the main patchelf binary statically, and not the test binaries. See: #529
1 parent 769337c commit 1aaf3c2

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
path: dist
9090
- name: Build binaries
9191
env:
92-
CXXFLAGS: "-D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wformat -Werror=format-security -O2 -static"
92+
CXXFLAGS: "-D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wformat -Werror=format-security -O2"
9393
run: |
9494
cat <<EOF > build.sh
9595
set -e
@@ -98,7 +98,7 @@ jobs:
9898
tar -xf dist/*.tar.bz2
9999
rm -f dist/*
100100
cd patchelf-*
101-
./configure --prefix /patchelf
101+
./configure --prefix /patchelf --with-static
102102
make check || (cat tests/test-suite.log; exit 1)
103103
make install-strip
104104
cd -

configure.ac

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,10 @@ AC_ARG_WITH([ubsan],
4141
)
4242
AM_CONDITIONAL([WITH_UBSAN], [test x"$with_ubsan" = xyes])
4343

44+
AC_ARG_WITH([static],
45+
AS_HELP_STRING([--with-static], [Build static binary])
46+
)
47+
AM_CONDITIONAL([WITH_STATIC], [test x"$with_static" = xyes])
48+
4449
AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile patchelf.spec])
4550
AC_OUTPUT

src/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ AM_CXXFLAGS += $(SAN_FLAGS)
1717
endif
1818
endif
1919

20+
if WITH_STATIC
21+
AM_CXXFLAGS += -static
22+
endif
23+
2024
bin_PROGRAMS = patchelf
2125

2226
patchelf_SOURCES = patchelf.cc elf.h patchelf.h

0 commit comments

Comments
 (0)