aboutsummaryrefslogtreecommitdiffstats
path: root/main/apk-tools/apk-tools-static.patch
blob: c122964b45b37416324acecf817d251c8210983b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
commit dd6008995a8e8509d71ffa906c837e7a320e8a15
Author: Timo Teräs <timo.teras@iki.fi>
Date:   Wed Jun 30 16:53:56 2010 +0300

    static build: do not use openssl engines
    
    We want minimal static build. And this now also breaks with our openssl
    since it tries to automatically dlopen some of the engine modules.

diff --git a/.gitignore b/.gitignore
index f6f9cf6..2b22f52 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 apk
+apk.static
 *.o
 *.d
 *.cmd
diff --git a/src/Makefile b/src/Makefile
index bea288e..c9cda6a 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -41,9 +41,10 @@ endif
 
 CFLAGS_ALL		+= -D_ATFILE_SOURCE
 CFLAGS_apk.o		:= -DAPK_VERSION=\"$(FULL_VERSION)\"
+CFLAGS_apk-static.o	:= -DAPK_VERSION=\"$(FULL_VERSION)\" -DOPENSSL_NO_ENGINE
 
 progs-$(STATIC)		+= apk.static
-apk.static-objs		:= $(apk-objs)
+apk.static-objs		:= $(filter-out apk.o,$(apk-objs)) apk-static.o
 LDFLAGS_apk.static	:= -static
 LDFLAGS_apk		+= -nopie -L$(obj)
 
diff --git a/src/apk-static.c b/src/apk-static.c
new file mode 120000
index 0000000..bf745af
--- /dev/null
+++ b/src/apk-static.c
@@ -0,0 +1 @@
+apk.c
\ No newline at end of file
diff --git a/src/apk.c b/src/apk.c
index 81bb950..4196f74 100644
--- a/src/apk.c
+++ b/src/apk.c
@@ -12,13 +12,17 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <ctype.h>
+#include <errno.h>
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
 #include <getopt.h>
 #include <sys/stat.h>
 
+#include <openssl/crypto.h>
+#ifndef OPENSSL_NO_ENGINE
 #include <openssl/engine.h>
+#endif
 
 #include "apk_defines.h"
 #include "apk_database.h"