~ubuntu-branches/ubuntu/saucy/curl/saucy-201307251546

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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#! /usr/bin/make -f

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_BUILD_ARCH		?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB_BUILD_ARCH_OS	?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)
DEB_BUILD_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_HOST_MULTIARCH	?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

# set the number of build jobs
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    JOBS:=-j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
endif

ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) --with-random=/dev/urandom
else
CROSS= --build $(DEB_BUILD_GNU_TYPE)
endif

ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
    DO_TEST=no
else
    DO_TEST=no
    ifeq (${DEB_BUILD_GNU_TYPE},${DEB_HOST_GNU_TYPE})
    ifneq (${DEB_BUILD_ARCH},m68k)
    ifneq (${DEB_BUILD_ARCH_OS},kfreebsd)
    ifneq (${DEB_BUILD_ARCH_OS},knetbsd)
    ifneq (${DEB_BUILD_ARCH_OS},hurd)
        DO_TEST=yes
    endif
    endif
    endif
    endif
    endif
endif

CFLAGS   = $(shell dpkg-buildflags --get CFLAGS)
CFLAGS  += $(shell dpkg-buildflags --get CPPFLAGS)
LDFLAGS  = $(shell dpkg-buildflags --get LDFLAGS)

# this will avoid unneded dependencies
LDFLAGS += -Wl,--as-needed

# this will catch miss-linking. (e.g. undefined symbols)
#LDFLAGS+= -Wl,-z,defs

CONFIGURE_ARGS_UDEB = $(CROSS) --prefix=/usr --mandir=/usr/share/man	\
			--disable-dependency-tracking --enable-ipv6	\
			--enable-manual	--enable-versioned-symbols	\
			--enable-debug					\
			--libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)	\
			CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
CONFIGURE_ARGS = $(CONFIGURE_ARGS_UDEB) --with-lber-lib=lber
# this is still not ready
#		--enable-ares
# this fixes the ldap warning of dpkg-shlibdebs, but we dont want that.
#		--with-ldap-lib=/usr/lib/libldap_r.so

ifneq (${DEB_BUILD_ARCH_OS},hurd)
CONFIGURE_ARGS += --with-gssapi=/usr
endif

build-arch: build-stamp
build-indep: build-stamp

build: build-arch build-indep

configure-stamp:
	dh_testdir
	mkdir -p debian/build debian/build-gnutls debian/build-nss debian/build-udeb
	# pop the last patch (nss)
	quilt pop
	# pop the second last patch (gnutls)
	quilt pop
	# get the source without nss and gnutls patches
	tar -cf - --exclude=debian --exclude=.pc . | tar -xf - -C debian/build
	tar -cf - --exclude=debian --exclude=.pc . | tar -xf - -C debian/build-udeb
	# push the second last patch which must be gnutls
	quilt push
	# get the source with gnutls patch applied
	tar -cf - --exclude=debian --exclude=.pc . | tar -xf - -C debian/build-gnutls
	# push the last patch which must be nss
	quilt push
	# get the source with nss patch applied
	tar -cf - --exclude=debian --exclude=.pc . | tar -xf - -C debian/build-nss
	# run buildconf and make sure to copy the patched ltmain.sh
	for flavour in build build-udeb build-gnutls build-nss; do \
		(cd debian/$$flavour && ./buildconf && cp ../../ltmain.sh .) \
	done
	cd debian/build && ./configure ${CONFIGURE_ARGS}		\
		--with-librtmp --with-ca-path=/etc/ssl/certs
	cd debian/build-udeb && ./configure ${CONFIGURE_ARGS_UDEB}	\
		--with-ca-path=/etc/ssl/certs --without-gnutls		\
		--without-nss --disable-ldap --disable-ldaps		\
		--disable-file --disable-ftp --disable-pop4		\
		--disable-rtsp --disable-imap --disable-smtp		\
		--without-librtmp --without-libidn
	cd debian/build-gnutls && ./configure ${CONFIGURE_ARGS}		\
		--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt	\
		--without-ssl --with-gnutls
	cd debian/build-nss && ./configure ${CONFIGURE_ARGS}		\
		--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt	\
		--without-ssl --with-nss
	touch configure-stamp

build-stamp: configure-stamp
	dh_testdir
	${MAKE} $(JOBS) -C debian/build
	${MAKE} $(JOBS) -C debian/build-udeb
	${MAKE} $(JOBS) -C debian/build-gnutls
	${MAKE} $(JOBS) -C debian/build-nss
ifeq (${DO_TEST},yes)
	-${MAKE} -C debian/build test
	-${MAKE} -C debian/build-udeb test
	-${MAKE} -C debian/build-gnutls test
	-${MAKE} -C debian/build-nss test
endif
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	$(RM) -r build-stamp configure-stamp debian/build* debian/tmp*

#install: DH_OPTIONS=
install: build-stamp
	dh_testdir
	dh_testroot
	dh_prep
	${MAKE} -C debian/build DESTDIR=$(shell pwd)/debian/tmp install
	${MAKE} -C debian/build-udeb DESTDIR=$(shell pwd)/debian/tmp-udeb install
	${MAKE} -C debian/build-gnutls DESTDIR=$(shell pwd)/debian/tmp-gnutls install
	${MAKE} -C debian/build-nss DESTDIR=$(shell pwd)/debian/tmp-nss install
	dh_install -plibcurl3-gnutls -plibcurl4-gnutls-dev --sourcedir=debian/tmp-gnutls
	dh_install -plibcurl3-nss -plibcurl4-nss-dev --sourcedir=debian/tmp-nss
	dh_install -plibcurl3-udeb --sourcedir=debian/tmp-udeb
	dh_install -Nlibcurl3-gnutls -Nlibcurl4-gnutls-dev -Nlibcurl3-nss -Nlibcurl4-nss-dev -Nlibcurl3-udeb --sourcedir=debian/tmp
	dh_lintian
	sed -i "/dependency_libs/ s/'.*'/''/" `find . -name '*.la'`

# Build architecture-independent files here.
binary-indep: build-stamp install
# We have nothing to do here.

# Build architecture-dependent files here.
binary-arch: build-stamp install
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installman
	dh_installexamples
	dh_installchangelogs CHANGES
	dh_link
	dh_strip -Nlibcurl3 -Nlibcurl3-gnutls -Nlibcurl3-nss
	dh_strip -plibcurl3 -plibcurl3-gnutls -plibcurl3-nss --dbg-package=libcurl3-dbg
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_md5sums
	dh_gencontrol
	dh_builddeb

binary: binary-indep binary-arch

.PHONY: binary binary-arch binary-indep build clean install