source: debian-alt/buster/rules @ 3527f25

Last change on this file since 3527f25 was 3527f25, checked in by zzz <zzz@…>, 18 months ago

Debian: Add build option for libtomcat9 (ticket #2364)

  • Property mode set to 100755
File size: 11.5 KB
Line 
1#!/usr/bin/make -f
2
3# Quoting Policy version 3.9.2.0, 2011-04-07 section 4.9:
4
5# /start quote
6# For some packages, notably ones where the same source tree is compiled in
7# different ways to produce two binary packages, the build target does not make
8# much sense. For these packages it is good enough to provide two (or more)
9# targets (build-a and build-b or whatever) for each of the ways of building the
10# package, and a build target that does nothing. The binary target will have to
11# build the package in each of the possible ways and make the binary package out
12# of each.
13# ...
14# When a package has a configuration and build routine which takes a long time,
15# or when the makefiles are poorly designed, or when build needs to run clean
16# first, it is a good idea to touch build when the build process is complete.
17# This will ensure that if debian/rules build is run again it will not rebuild
18# the whole program.
19# /end quote
20
21# Since that fits building I2P very well, we override the build target.
22#
23
24build:
25        @echo 'The build target is disabled. Use the appropriate binary target.'
26
27JAVA_HOME=/usr/lib/jvm/default-java
28I2P=$(CURDIR)/pkg-temp
29ROUTERVERSION=$(CURDIR)/router/java/src/net/i2p/router/RouterVersion.java
30export DEB_BUILD_HARDENING=1
31
32# I2P's version will be displayed in the router console as "$I2PVERSION-$EXTRAPREFIX$DEBIANVERSION", eg. 0.8.12-0-deb1
33#export EXTRAPREFIX := deb
34export JAVA_HOME I2P
35export DEBIANVERSION := $(shell dpkg-parsechangelog |awk -F' ' '/^Version:/{print $$2}' |sed 's/.*-\([.0-9A-Za-z~+]\{1,\}\)$$/\1/')
36# required for jbigi/jcpuid build
37export BITS := $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS)
38#export DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
39
40%:
41        dh $@ --with systemd,bash-completion
42
43clean: createcopyright
44
45override_dh_auto_clean:
46        -[ -r $(CURDIR)/debian/routerversion.java.bak ] && mv -f $(CURDIR)/debian/routerversion.java.bak $(ROUTERVERSION)
47        dh_auto_clean
48        ant distclean
49        find $(CURDIR)/core \( -name '*\.so' -o -name '*\.o' \) -exec rm -f {} \;
50        rm -rf $(CURDIR)/core/c/jcpuid/lib/
51        rm -f $(CURDIR)/installer/lib/wrapper/all/wrapper.jar
52        rm -rf $(CURDIR)/debian/python-i2p
53        rm -f $(CURDIR)/override.properties
54        rm -f $(CURDIR)/apps/susidns/src/lib/standard.jar
55        rm -f $(CURDIR)/apps/susidns/src/lib/jstl.jar
56        rm -f $(CURDIR)/apps/susidns/src/lib/jstlel.jar
57        debconf-updatepo
58
59override_dh_auto_build:
60
61override_dh_systemd_enable:
62        # We purposely do not set I2P to start at boot.
63        # This matches the behavior of the initscript
64        # and the setting RUN_DAEMON=false in /etc/default/i2p
65
66binary-indep: build-indep
67build-indep:
68        dh_prep
69        mkdir -p $(CURDIR)/installer/lib/wrapper/all
70        ln -sf /usr/share/java/wrapper.jar $(CURDIR)/installer/lib/wrapper/all/wrapper.jar
71        if [ ! -e $(CURDIR)/debian/routerversion.java.bak ]; then \
72                cp $(ROUTERVERSION) $(CURDIR)/debian/routerversion.java.bak; \
73        fi
74ifeq "$(findstring deb,$(shell grep 'deb' $(ROUTERVERSION)))" ""
75        sed -e "s/\(.*EXTRA\ =\ \)[^ ]*\"\(.*\)\"/\1\"-$$EXTRAPREFIX$$DEBIANVERSION\"/" < $(ROUTERVERSION) > $(ROUTERVERSION).tmp
76        mv -f $(ROUTERVERSION).tmp $(ROUTERVERSION)
77else
78        @echo "Already found deb in version, not doing anything"
79endif
80        @# build options
81        @/bin/echo -e "javac.version=1.8" > $(CURDIR)/override.properties
82#       @/bin/echo -e "javac.version=9" > $(CURDIR)/override.properties
83#       @/bin/echo -e "javac.compilerargs=-bootclasspath $(JAVA_HOME)/jre/lib/rt.jar:$(JAVA_HOME)/jre/lib/jce.jar" >> $(CURDIR)/override.properties
84        @/bin/echo -e "javac.compilerargs=-source 1.8 -target 1.8" >> $(CURDIR)/override.properties
85#       @/bin/echo -e "javac.compilerargs7=-bootclasspath $(JAVA_HOME)/jre/lib/rt.jar:$(JAVA_HOME)/jre/lib/jce.jar" >> $(CURDIR)/override.properties
86        @/bin/echo -e "javac.compilerargs7=" >> $(CURDIR)/override.properties
87        @/bin/echo -e "build.built-by=debian" >> $(CURDIR)/override.properties
88
89        @# debian and ubuntu: everywhere
90        @/bin/echo -e "with-geoip-database=true" >> $(CURDIR)/override.properties
91
92        @# ubuntu: in xenial
93        @# debian: in jessie-backports stretch sid
94        @/bin/echo -e "with-libjetty9-java=true" >> $(CURDIR)/override.properties
95        mkdir -p $(CURDIR)/apps/jetty/jettylib
96        ln -sf /usr/share/java/jetty9-continuation.jar $(CURDIR)/apps/jetty/jettylib/jetty-continuation.jar
97        ln -sf /usr/share/java/jetty9-deploy.jar $(CURDIR)/apps/jetty/jettylib/jetty-deploy.jar
98        ln -sf /usr/share/java/jetty9-http.jar $(CURDIR)/apps/jetty/jettylib/jetty-http.jar
99        ln -sf /usr/share/java/jetty9-io.jar $(CURDIR)/apps/jetty/jettylib/jetty-io.jar
100        ln -sf /usr/share/java/jetty9-rewrite.jar $(CURDIR)/apps/jetty/jettylib/jetty-rewrite-handler.jar
101        ln -sf /usr/share/java/jetty9-security.jar $(CURDIR)/apps/jetty/jettylib/jetty-security.jar
102        ln -sf /usr/share/java/jetty9-servlet.jar $(CURDIR)/apps/jetty/jettylib/jetty-servlet.jar
103        ln -sf /usr/share/java/jetty9-servlets.jar $(CURDIR)/apps/jetty/jettylib/jetty-servlets.jar
104        ln -sf /usr/share/java/jetty9-start.jar $(CURDIR)/apps/jetty/jettylib/jetty-start.jar
105        ln -sf /usr/share/java/jetty9-util.jar $(CURDIR)/apps/jetty/jettylib/jetty-util.jar
106        ln -sf /usr/share/java/jetty9-webapp.jar $(CURDIR)/apps/jetty/jettylib/jetty-webapp.jar
107        ln -sf /usr/share/java/jetty9-xml.jar $(CURDIR)/apps/jetty/jettylib/jetty-xml.jar
108        ln -sf /usr/share/java/jetty9-server.jar $(CURDIR)/apps/jetty/jettylib/org.mortbay.jetty.jar
109        ln -sf /usr/share/java/jetty9-jmx.jar $(CURDIR)/apps/jetty/jettylib/org.mortbay.jmx.jar
110        @# following two are from libservlet3.1-java which is a dependency of libjetty9-java
111        ln -sf /usr/share/java/servlet-api-3.1.jar $(CURDIR)/apps/jetty/jettylib/javax.servlet.jar
112        @# this is roughly the same as tomcat8-jsp-api.jar, we use this one
113        ln -sf /usr/share/java/jsp-api-2.3.jar $(CURDIR)/apps/jetty/jettylib/jsp-api.jar
114
115        @# debian and ubuntu: wheezy-backports, jessie+, xenial+
116        @#/bin/echo -e "with-libtomcat8-java=true" >> $(CURDIR)/override.properties
117        @#mkdir -p $(CURDIR)/apps/jetty/jettylib
118        @#ln -sf /usr/share/java/tomcat8-api.jar $(CURDIR)/apps/jetty/jettylib/tomcat-api.jar
119        @#ln -sf /usr/share/java/tomcat8-coyote.jar $(CURDIR)/apps/jetty/jettylib/tomcat-coyote.jar
120        @#ln -sf /usr/share/java/tomcat8-el-api.jar $(CURDIR)/apps/jetty/jettylib/commons-el.jar
121        @#ln -sf /usr/share/java/tomcat8-jasper.jar $(CURDIR)/apps/jetty/jettylib/jasper-runtime.jar
122        @#ln -sf /usr/share/java/tomcat8-jasper-el.jar $(CURDIR)/apps/jetty/jettylib/jasper-el.jar
123        @#ln -sf /usr/share/java/tomcat8-juli.jar $(CURDIR)/apps/jetty/jettylib/commons-logging.jar
124        @#ln -sf /usr/share/java/tomcat8-util.jar $(CURDIR)/apps/jetty/jettylib/tomcat-util.jar
125        @#ln -sf /usr/share/java/tomcat8-util-scan.jar $(CURDIR)/apps/jetty/jettylib/tomcat-util-scan.jar
126
127        @# debian and ubuntu: buster, disco
128        @/bin/echo -e "with-libtomcat9-java=true" >> $(CURDIR)/override.properties
129        mkdir -p $(CURDIR)/apps/jetty/jettylib
130        ln -sf /usr/share/java/tomcat9-api.jar $(CURDIR)/apps/jetty/jettylib/tomcat-api.jar
131        ln -sf /usr/share/java/tomcat9-coyote.jar $(CURDIR)/apps/jetty/jettylib/tomcat-coyote.jar
132        ln -sf /usr/share/java/tomcat9-el-api.jar $(CURDIR)/apps/jetty/jettylib/commons-el.jar
133        ln -sf /usr/share/java/tomcat9-jasper.jar $(CURDIR)/apps/jetty/jettylib/jasper-runtime.jar
134        ln -sf /usr/share/java/tomcat9-jasper-el.jar $(CURDIR)/apps/jetty/jettylib/jasper-el.jar
135        ln -sf /usr/share/java/tomcat9-juli.jar $(CURDIR)/apps/jetty/jettylib/commons-logging.jar
136        ln -sf /usr/share/java/tomcat9-util.jar $(CURDIR)/apps/jetty/jettylib/tomcat-util.jar
137        ln -sf /usr/share/java/tomcat9-util-scan.jar $(CURDIR)/apps/jetty/jettylib/tomcat-util-scan.jar
138
139        @# debian and ubuntu: stretch+, zesty+
140        @/bin/echo -e "with-libtaglibs-standard=true" >> $(CURDIR)/override.properties
141        ln -sf /usr/share/java/taglibs-standard-spec.jar $(CURDIR)/apps/susidns/src/lib/jstl.jar
142        ln -sf /usr/share/java/taglibs-standard-impl.jar $(CURDIR)/apps/susidns/src/lib/standard.jar
143        ln -sf /usr/share/java/taglibs-standard-jstlel.jar $(CURDIR)/apps/susidns/src/lib/jstlel.jar
144
145        @# debian and ubuntu: everywhere
146        @#/bin/echo -e "with-glassfish-javaee=true" >> $(CURDIR)/override.properties
147        @# glassfish-javaee.jar has ancient and conflicting classes, e.g. javax.mail
148        @#ln -sf /usr/share/java/glassfish-javaee.jar $(CURDIR)/apps/susidns/src/lib/jstl.jar
149        @#ln -sf /usr/share/java/glassfish-appserv-jstl.jar $(CURDIR)/apps/susidns/src/lib/standard.jar
150
151        @# debian and ubuntu: everywhere
152        @#/bin/echo -e "with-libjakarta-taglibs-standard-java=true" >> $(CURDIR)/override.properties
153        @#ln -sf /usr/share/java/standard.jar $(CURDIR)/apps/susidns/src/lib/standard.jar
154
155        @# debian and ubuntu: everywhere
156        @#/bin/echo -e "with-libjstl1.1-java=true" >> $(CURDIR)/override.properties
157        @#ln -sf /usr/share/java/jstl1.1.jar $(CURDIR)/apps/susidns/src/lib/jstl.jar
158
159        @# debian and ubuntu: everywhere
160        @/bin/echo -e "with-gettext-base=true" >> $(CURDIR)/override.properties
161        @mkdir -p $(CURDIR)/core/java/build
162        ln -sf /usr/share/java/libintl.jar $(CURDIR)/core/java/build/libintl.jar
163
164        @# debian and ubuntu: everywhere
165        @/bin/echo -e "with-libgetopt-java=true" >> $(CURDIR)/override.properties
166        @mkdir -p $(CURDIR)/core/java/build
167        ln -sf /usr/share/java/gnu-getopt.jar $(CURDIR)/core/java/build/gnu-getopt.jar
168
169        @# debian: jessie+; ubuntu: trusty+
170        @/bin/echo -e "with-libjson-simple-java=true" >> $(CURDIR)/override.properties
171        @mkdir -p $(CURDIR)/core/java/build
172        ln -sf /usr/share/java/json-simple.jar $(CURDIR)/core/java/build/json-simple.jar
173
174        @# debian: everywhere; ubuntu: trusty+
175        @/bin/echo -e "with-famfamfam-flag-png=true" >> $(CURDIR)/override.properties
176
177        @# 2 MB of dependencies vs. 20 KB of copied source
178        @# Requires 4.4 or higher.
179        @# Debian: Not in wheezy/jessie
180        @# Ubuntu: Only in wily and later
181        @#/bin/echo -e "with-libhttpclient-java=true" >> $(CURDIR)/override.properties
182        @#mkdir -p $(CURDIR)/core/java/build
183        @#ln -sf /usr/share/java/httpclient.jar $(CURDIR)/core/java/build/httpclient.jar
184        @#ln -sf /usr/share/java/httpcore.jar $(CURDIR)/core/java/build/httpcore.jar
185
186        TZ=UTC JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 ant preppkg-unix javadoc
187        echo router.updateDisabled=true > $(I2P)/router.config
188        mv $(I2P)/runplain.sh $(I2P)/i2prouter-nowrapper
189
190binary-arch: build-arch
191build-arch:
192        # build jbigi
193        cd $(CURDIR)/core/c/jbigi && ./build_jbigi.sh dynamic
194        # build jcpuid
195        cd $(CURDIR)/core/c/jcpuid && ./build.sh
196
197binary: binary-arch binary-indep
198
199createcopyright:
200        @echo " *** Creating debian/copyright*** "
201        @rm -f $(CURDIR)/debian/copyright
202        @/bin/echo -e "This package was Debianized by kytv <killyourtv@i2pmail.org>" >> $(CURDIR)/debian/copyright
203        @/bin/echo -e "Sun, 23 Jan 2011 20:26:51 +0000" >> $(CURDIR)/debian/copyright
204        @/bin/echo -e "\nIt was downloaded from https://geti2p.net" >> $(CURDIR)/debian/copyright
205        @/bin/echo -e "\nI2P is tracked upstream using the Monotone VCS" >> $(CURDIR)/debian/copyright
206        @/bin/echo -e "Complete information on fetching the source with monotone can be found" >> $(CURDIR)/debian/copyright
207        @/bin/echo -e "at https://geti2p.net/newdevelopers#getting-the-i2p-code\n\n\n" >> $(CURDIR)/debian/copyright
208        @/bin/cat $(CURDIR)/LICENSE.txt >> $(CURDIR)/debian/copyright
209        @/bin/echo -e "\n\n The debian packaging has been released into the public domain." >> $(CURDIR)/debian/copyright
210
211override_dh_compress:
212        dh_compress -X.xsl -X.xml
213
214override_dh_install:
215        dh_install --list-missing
216        dh_apparmor --profile-name=system_i2p -pi2p
217        dh_apparmor --profile-name=usr.bin.i2prouter -pi2p
218
219override_dh_installchangelogs:
220        dh_installchangelogs history.txt
221
222override_dh_installdocs:
223        dh_installdocs -pi2p -plibjbigi-jni --link-doc=i2p-router
224        dh_installdocs --remaining-packages
225
226override_dh_shlibdeps:
227        dh_shlibdeps -llibjbigi-jni debian/libjbigi-jni/usr/lib/jni/*.so
228
229#override_dh_installinit:
230#       dh_installinit -r
231
232get-orig-source:
233        uscan --verbose --rename --destdir $(CURDIR)/.. --watchfile debian/watch --force-download
Note: See TracBrowser for help on using the repository browser.