3 # this will avoid unneded dependencies
4 export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
6 # this will catch miss-linking. (e.g. undefined symbols)
7 #export DEB_LDFLAGS_MAINT_APPEND = -Wl,-z,defs
9 # enable all hardening options (see #763372)
10 export DEB_BUILD_MAINT_OPTIONS := hardening=+all
12 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
13 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
15 CONFIGURE_ARGS = -- --disable-dependency-tracking \
16 --disable-symbol-hiding --enable-versioned-symbols \
17 --enable-threaded-resolver --with-lber-lib=lber \
18 --with-gssapi=/usr --with-nghttp2 \
19 --includedir=/usr/include/$(DEB_HOST_MULTIARCH) \
20 --with-zsh-functions-dir=/usr/share/zsh/vendor-completions
25 override_dh_auto_configure:
26 mkdir -p debian/build debian/build-gnutls debian/build-nss
27 # pop the last patch (nss)
29 # pop the second last patch (gnutls)
31 # get the source without nss and gnutls patches
32 tar -cf - --exclude=debian/build* --exclude=.pc . \
33 | tar -xf - -C debian/build
34 # push the second last patch which must be gnutls
36 # get the source with gnutls patch applied
37 tar -cf - --exclude=debian/build* --exclude=.pc . \
38 | tar -xf - -C debian/build-gnutls
39 # push the last patch which must be nss
41 # get the source with nss patch applied
42 tar -cf - --exclude=debian/build* --exclude=.pc . \
43 | tar -xf - -C debian/build-nss
44 # run buildconf and make sure to copy the patched ltmain.sh
45 for flavour in build build-gnutls build-nss; do \
46 (cd debian/$$flavour && ./buildconf && cp ../../ltmain.sh .) \
48 cd debian/build && dh_auto_configure ${CONFIGURE_ARGS} \
49 --with-ca-path=/etc/ssl/certs \
50 --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt
51 cd debian/build-gnutls && dh_auto_configure ${CONFIGURE_ARGS} \
52 --with-ca-path=/etc/ssl/certs \
53 --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \
54 --without-ssl --with-gnutls
55 cd debian/build-nss && dh_auto_configure ${CONFIGURE_ARGS} \
56 --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \
57 --without-ssl --with-nss
59 override_dh_auto_build:
60 cd debian/build && dh_auto_build
61 cd debian/build-gnutls && dh_auto_build
62 cd debian/build-nss && dh_auto_build
64 override_dh_auto_test:
65 -cd debian/build && dh_auto_test
66 -cd debian/build-gnutls && dh_auto_test
67 -cd debian/build-nss && dh_auto_test
70 ${MAKE} -C debian/build \
71 DESTDIR=$(shell pwd)/debian/tmp install
72 ${MAKE} -C debian/build-gnutls \
73 DESTDIR=$(shell pwd)/debian/tmp-gnutls install
74 ${MAKE} -C debian/build-nss \
75 DESTDIR=$(shell pwd)/debian/tmp-nss install
76 dh_install -plibcurl3-gnutls -plibcurl4-gnutls-dev \
77 --sourcedir=debian/tmp-gnutls
78 dh_install -plibcurl3-nss -plibcurl4-nss-dev \
79 --sourcedir=debian/tmp-nss
80 dh_install -pcurl -plibcurl3 -plibcurl4-openssl-dev -plibcurl4-doc \
81 --sourcedir=debian/tmp
82 sed -i "/dependency_libs/ s/'.*'/''/" `find . -name '*.la'`
83 # Modify curl-config to make it architecture-independent:
84 # 1. In --static-libs output, replace the output of krb5-config (which
85 # currently includes architecture-specific paths) with a call at
86 # runtime to krb5-config. Of course, this will only work correctly
87 # if the installed libkrb5-dev matches the architecture of the
88 # program you're linking, or if libkrb5-dev is made
89 # multiarch-compatible at some point in the future. For dynamic
90 # linking this has no impact.
91 # 2. In --configure output, replace the architecture-specific paths
92 # used for --libdir and --libexecdir with a literal backquoted call
93 # to dpkg-architecture. This is functionally equivalent to the way
94 # debhelper actually invokes configure, and indicates to the user
95 # (who runs curl-config --configure in order to learn about how the
96 # library was compiled) that they are in fact using a multi-arch
98 # 3. Likewise, replace the architecture name used for --build (and
99 # build_alias) with a literal backquoted call to dpkg-architecture.
100 sed -e "/-lcurl /s|`krb5-config --libs gssapi`|\`krb5-config --libs gssapi\`|" \
101 -e "/--prefix/s|/$(DEB_HOST_MULTIARCH)'|/'\\\\\`dpkg-architecture -qDEB_HOST_MULTIARCH\\\\\`|g" \
102 -e "/--prefix/s|=$(DEB_BUILD_GNU_TYPE)'|='\\\\\`dpkg-architecture -qDEB_BUILD_GNU_TYPE\\\\\`|g" \
103 -i `find . -name curl-config`
105 override_dh_installchangelogs:
106 dh_installchangelogs CHANGES
108 override_dh_compress:
111 override_dh_auto_clean:
112 $(RM) -r debian/build* debian/tmp*