From db2364e9aaa6c8bbcd31ea636a5debfa11f77742 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Sun, 22 Jan 2023 19:03:49 +0300 Subject: [PATCH] [gha] add ubuntu static build Signed-off-by: R4SAS --- .github/workflows/build.yml | 17 +++++++++++++++++ Makefile.linux | 27 ++++++++------------------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d8828f61..c47f985f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,3 +38,20 @@ jobs: cd build cmake -DWITH_UPNP=${{ matrix.with_upnp }} . make -j3 + build-static: + name: Static build with UPnP + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: install packages + run: | + sudo add-apt-repository ppa:mhier/libboost-latest + sudo apt-get update + sudo apt-get install build-essential libboost1.74-dev libminiupnpc-dev libssl-dev zlib1g-dev + - name: build application + run: make DEBUG=no USE_STATIC=yes USE_UPNP=yes -j`nproc` + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: i2pd-static-linux-x86_64 + path: i2pd diff --git a/Makefile.linux b/Makefile.linux index 9a3fdda3..4098ad1f 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -20,10 +20,10 @@ else ifeq ($(shell expr match ${CXXVER} "4\.[8-9]"),3) # gcc 4.8 - 4.9 else ifeq ($(shell expr match ${CXXVER} "[5-6]"),1) # gcc 5 - 6 NEEDED_CXXFLAGS += -std=c++11 LDLIBS = -latomic -else ifeq ($(shell expr match ${CXXVER} "[7-9]"),1) # gcc 7 - 9 +else ifeq ($(shell expr match ${CXXVER} "[7-9]"),1) # gcc 7 - 9 NEEDED_CXXFLAGS += -std=c++17 LDLIBS = -latomic -else ifeq ($(shell expr match ${CXXVER} "1[0-9]"),2) # gcc 10 - 19 +else ifeq ($(shell expr match ${CXXVER} "1[0-9]"),2) # gcc 10+ # NEEDED_CXXFLAGS += -std=c++20 NEEDED_CXXFLAGS += -std=c++17 LDLIBS = -latomic @@ -33,31 +33,20 @@ endif NEEDED_CXXFLAGS += -fPIC -ifeq ($(USE_STATIC),yes) # NOTE: on glibc you will get this warning: # Using 'getaddrinfo' in statically linked applications requires at runtime # the shared libraries from the glibc version used for linking - LIBDIR := /usr/lib/$(SYS) - LDLIBS += $(LIBDIR)/libboost_system.a - LDLIBS += $(LIBDIR)/libboost_date_time.a - LDLIBS += $(LIBDIR)/libboost_filesystem.a - LDLIBS += $(LIBDIR)/libboost_program_options.a - LDLIBS += $(LIBDIR)/libssl.a - LDLIBS += $(LIBDIR)/libcrypto.a - LDLIBS += $(LIBDIR)/libz.a -ifeq ($(USE_UPNP),yes) - LDLIBS += $(LIBDIR)/libminiupnpc.a -endif - LDLIBS += -lpthread -ldl +ifeq ($(USE_STATIC),yes) + LDLIBS += -ldl -Wl,-Bstatic -pthread -static-libgcc -static-libstdc++ else - LDLIBS += -lcrypto -lssl -lz -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lpthread -ifeq ($(USE_UPNP),yes) - LDLIBS += -lminiupnpc -endif + LDLIBS += -lpthread endif +LDLIBS += -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lssl -lcrypto -lz + # UPNP Support (miniupnpc 1.5 and higher) ifeq ($(USE_UPNP),yes) + LDLIBS += -lminiupnpc NEEDED_CXXFLAGS += -DUSE_UPNP endif