link curl statically

This commit is contained in:
mrbesen 2021-12-02 01:48:27 +01:00
parent d6b4986bf7
commit e8e1b867bb
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
5 changed files with 29 additions and 3 deletions

3
.gitmodules vendored
View File

@ -2,3 +2,6 @@
path = thirdparty/TAPI
url = ssh://gitea@git.okaestne.de:2233/okaestne/TAPI.git
branch = wip
[submodule "thirdparty/curl"]
path = thirdparty/curl
url = https://github.com/curl/curl.git

View File

@ -24,7 +24,16 @@ LOGF = $(TAPIF)Log/
LOGO = $(LOGF)Log.o
INCLUDES = -I$(LOGF) -I$(TAPIF)include/ $(addprefix -I, $(INCFS))
LDFLAGS = -lcurl -lseccomp -lcap
LDFLAGS = -lseccomp -lcap
#dynamic linked curl
#LDFLAGS += -lcurl
#required for static linked curl
LDFLAGS += -lidn2 -lssl -lcrypto -lz
#statically linked curl
CURLA = $(TP)curl/libcurl.a
SRCFILES = $(shell find $(SRCF) -name "*.cpp")
OBJFILES = $(patsubst $(SRCF)%, $(BUILDDIR)%, $(patsubst %.cpp, %.o, $(SRCFILES))) $(LOGO)
@ -39,7 +48,7 @@ INCLUDES += $(addprefix -I, $(SOURCEDIRS))
all: $(NAME) runtest
$(NAME): $(BUILDDIRS) $(DEPF) $(OBJFILES) $(TAPIA)
$(NAME): $(BUILDDIRS) $(DEPF) $(OBJFILES) $(TAPIA) $(CURLA)
@echo "Linking $@"
@$(CXX) $(CFLAGS) -o $@ $(filter %.o, $^) $(filter %.a, $^) $(LDFLAGS)
@ -69,7 +78,7 @@ clean:
$(MAKE) -C $(LOGF) $@
$(MAKE) -C $(TAPIF) $@
$(NAMETEST): $(BUILDDIRS) $(DEPF) $(TESTF)*.cpp $(OBJFILESTEST) $(TAPIA)
$(NAMETEST): $(BUILDDIRS) $(DEPF) $(TESTF)*.cpp $(OBJFILESTEST) $(TAPIA) $(CURLA)
@echo "Compiling tests"
$(CXX) -o $@ $(filter %.o, $^) $(filter %.a, $^) $(filter %.cpp, $^) $(CFLAGS) -I$(SRCF) $(INCLUDES) $(LDFLAGS)

10
Readme.md Normal file
View File

@ -0,0 +1,10 @@
# Compile curl
```
./configure --with-openssl --disable-shared --disable-thread --disable-cookies --disable-doh --disable-manual --disable-proxy --disable-pthreads --disable-socketpair --disable-threaded-resolver --disable-unix-sockets --disable-imap --disable-tftp --disable-mqtt --disable-pop3 --disable-ftp --disable-smtp --disable-rtsp --disable-telnet --disable-smb --disable-gopher --disable-dict
make
# create a link
ln -sr lib/.lib/libcurl.a ./
```

View File

@ -70,6 +70,8 @@ static bool enableSecurity() {
seccomp_rule_add(scmp, SCMP_ACT_ALLOW, SCMP_SYS(exit), 0);
seccomp_rule_add(scmp, SCMP_ACT_ALLOW, SCMP_SYS(exit_group), 0);
seccomp_rule_add(scmp, SCMP_ACT_ALLOW, SCMP_SYS(rt_sigaction), 0);
seccomp_rule_add(scmp, SCMP_ACT_ALLOW, SCMP_SYS(rt_sigreturn), 0); // return form a signal
seccomp_rule_add(scmp, SCMP_ACT_ALLOW, SCMP_SYS(sigreturn), 0); // return from a signal
seccomp_rule_add(scmp, SCMP_ACT_ALLOW, SCMP_SYS(writev), 0);
seccomp_rule_add(scmp, SCMP_ACT_ALLOW, SCMP_SYS(readv), 0);
@ -86,6 +88,7 @@ static bool enableSecurity() {
seccomp_rule_add(scmp, SCMP_ACT_ALLOW, SCMP_SYS(socket), 0);
seccomp_rule_add(scmp, SCMP_ACT_ALLOW, SCMP_SYS(setsockopt), 0);
seccomp_rule_add(scmp, SCMP_ACT_ALLOW, SCMP_SYS(getsockopt), 0);
seccomp_rule_add(scmp, SCMP_ACT_ALLOW, SCMP_SYS(getsockname), 0);
seccomp_rule_add(scmp, SCMP_ACT_ALLOW, SCMP_SYS(set_robust_list), 0);
seccomp_rule_add(scmp, SCMP_ACT_ALLOW, SCMP_SYS(get_robust_list), 0);
seccomp_rule_add(scmp, SCMP_ACT_ALLOW, SCMP_SYS(sendmmsg), 0);

1
thirdparty/curl vendored Submodule

@ -0,0 +1 @@
Subproject commit 34294a65b29b19ed3699f7cdd7ff98bdf02b1d48