-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
114 lines (94 loc) · 2.95 KB
/
Makefile
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Source
ARCHIVE_GNUTLS=https://www.gnupg.org/ftp/gcrypt/gnutls/v3.5/gnutls-3.5.19.tar.xz
ARCHIVE_LIBTASN=https://ftp.gnu.org/gnu/libtasn1/libtasn1-4.13.tar.gz
ARCHIVE_NETTLE=https://ftp.gnu.org/gnu/nettle/nettle-3.4.tar.gz
ARCHIVE_GMPLIB=https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz
# Build
ROOT_DIR=${PWD}
MAKE=make
CFLAGS="-O3 -I${ROOT_DIR}/build/include"
CONFIGURE=./configure CFLAGS=${CFLAGS} --prefix=${ROOT_DIR}/build --disable-static
CURL=curl -s
EXTRACT_XZ=tar -xJ
EXTRACT_GZ=tar -xz
DTLSD_LIBS=-lgnutls -ltasn1 -lnettle -lhogweed -lgmp
DTLSD_LDFLAGS=-L${ROOT_DIR}/build/lib
PKG_CONFIG_PATH=${ROOT_DIR}/build/lib/pkgconfig
all: dtlsd
dtlsd: build/lib/libgnutls.a build/lib/libgmp.a build/lib/libtasn1.a build/lib/libnettle.a
gcc -Wall -I${ROOT_DIR}/build/include dtlsd.c ${DTLSD_LDFLAGS} ${DTLSD_LIBS} -o dtlsd
clean:
rm -rf gnutls-3.5.19 gmp-6.1.2 nettle-3.4 libtasn1-4.13
# gmp
gmp-6.1.2/configure:
${CURL} ${ARCHIVE_GMPLIB} | ${EXTRACT_XZ}
gmp-6.1.2/Makefile: gmp-6.1.2/configure
cd gmp-6.1.2 && \
${CONFIGURE} && \
cd -
build/lib/libgmp.a: gmp-6.1.2/Makefile
cd gmp-6.1.2 && ${MAKE} install && cd -
# libtasn1
libtasn1-4.13/configure:
${CURL} ${ARCHIVE_LIBTASN} | ${EXTRACT_GZ}
libtasn1-4.13/Makefile: libtasn1-4.13/configure
cd libtasn1-4.13 && \
${CONFIGURE} \
--disable-doc \
--disable-valgrind-tests && \
cd -
build/lib/libtasn1.a: libtasn1-4.13/Makefile
cd libtasn1-4.13 && ${MAKE} install && cd -
# nettle
nettle-3.4/configure:
${CURL} ${ARCHIVE_NETTLE} | ${EXTRACT_GZ}
nettle-3.4/Makefile: nettle-3.4/configure build/lib/libgmp.a
cd nettle-3.4 && \
${CONFIGURE} \
LDFLAGS="-L${ROOT_DIR}/build/lib" \
LIBS="-lgmp" \
--enable-x86-aesni \
--disable-openssl \
--disable-documentation && \
cd -
build/lib/libnettle.a: nettle-3.4/Makefile
cd nettle-3.4 && ${MAKE} install && cd -
# gnutls
gnutls-3.5.19/configure:
${CURL} ${ARCHIVE_GNUTLS} | ${EXTRACT_XZ}
gnutls-3.5.19/Makefile: gnutls-3.5.19/configure build/lib/libnettle.a build/lib/libtasn1.a build/lib/libgmp.a
cd gnutls-3.5.19 && \
${CONFIGURE} \
NETTLE_CFLAGS="-I${ROOT_DIR}/build/include" \
NETTLE_LIBS="-lnettle" \
HOGWEED_CFLAGS="-I${ROOT_DIR}/build/include" \
HOGWEED_LIBS="-lhogweed" \
GMP_CFLAGS="-I${ROOT_DIR}/build/include" \
GMP_LIBS="-lgmp" \
LIBTASN1_CFLAGS="-I${ROOT_DIR}/build/include" \
LIBTASN1_LIBS="-ltasn1" \
LDFLAGS=-L${ROOT_DIR}/build/lib \
--disable-maintainer-mode \
--disable-doc \
--disable-tools \
--disable-cxx \
--disable-padlock \
--disable-ssl3-support \
--disable-ssl2-support \
--disable-tests \
--disable-valgrind-tests \
--disable-full-test-suite \
--disable-rpath \
--disable-libtool-lock \
--disable-libdane \
--without-p11-kit \
--without-tpm \
--with-included-unistring \
--without-zlib \
--without-libz-prefix \
--without-idn \
--with-system-priority-file="${HOME}/default-priorities" \
&& \
cd -
build/lib/libgnutls.a: gnutls-3.5.19/Makefile
cd gnutls-3.5.19 && ${MAKE} install && cd -