source: debian/rules @ cbf0239

Last change on this file since cbf0239 was a598d90, checked in by HungryHobo <HungryHobo@…>, 11 years ago

strip binaries in debian package (lintian: unstripped-binary-or-object)

  • Property mode set to 100755
File size: 5.3 KB
Line 
1#!/usr/bin/make -f
2
3VERSION=`grep String\ VERSION core/java/src/net/i2p/CoreVersion.java | cut -d\" -f2`
4SOURCEURL=http://mirror.i2p2.de/i2psource_${VERSION}.tar.bz2
5
6DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
7ifeq ($(DEB_HOST_ARCH),i386)
8wrapperpath = installer/lib/wrapper/linux
9else ifeq ($(DEB_HOST_ARCH),amd64)
10wrapperpath = installer/lib/wrapper/linux64
11# other architectures could be supported by using runplain.sh
12endif
13
14build:
15        echo Target Architecture is $(DEB_HOST_ARCH)
16ifndef wrapperpath
17        @echo "Architecture not supported: $(DEB_HOST_ARCH)"
18        exit 1
19endif
20        ant preppkg-linux-only
21       
22        mkdir -p debian/tmp/etc/init.d
23        mkdir -p debian/tmp/etc/i2p
24        mkdir -p debian/tmp/usr/share/i2p/lib
25        mkdir -p debian/tmp/usr/share/doc/i2p
26        mkdir -p debian/tmp/usr/share/man/man1
27        mkdir -p debian/tmp/usr/lib/i2p
28        mkdir -p debian/tmp/usr/bin
29       
30        cp -a debian/scripts/init debian/tmp/etc/init.d/i2p
31       
32        @# copy config templates to /etc/i2p
33        cp -a pkg-temp/blocklist.txt debian/tmp/etc/i2p/
34        cp -a pkg-temp/clients.config debian/tmp/etc/i2p/
35        cp -a pkg-temp/hosts.txt debian/tmp/etc/i2p/
36        cp -a pkg-temp/i2psnark.config debian/tmp/etc/i2p/
37        cp -a pkg-temp/i2ptunnel.config debian/tmp/etc/i2p/
38        cp -a pkg-temp/jetty-i2psnark.xml debian/tmp/etc/i2p/
39        cp -a pkg-temp/systray.config debian/tmp/etc/i2p/
40       
41        @# copy architecture independent files to /usr/share/i2p and create symlinks to /etc/i2p/
42        ln -s /etc/i2p/blocklist.txt debian/tmp/usr/share/i2p/blocklist.txt
43        ln -s /etc/i2p/clients.config debian/tmp/usr/share/i2p/clients.config
44        ln -s /etc/i2p/hosts.txt debian/tmp/usr/share/i2p/hosts.txt
45        ln -s /etc/i2p/i2psnark.config debian/tmp/usr/share/i2p/i2psnark.config
46        ln -s /etc/i2p/i2ptunnel.config debian/tmp/usr/share/i2p/i2ptunnel.config
47        ln -s /etc/i2p/jetty-i2psnark.xml debian/tmp/usr/share/i2p/jetty-i2psnark.xml
48        ln -s /etc/i2p/systray.config debian/tmp/usr/share/i2p/systray.config
49        ln -s /etc/i2p/wrapper.config debian/tmp/usr/share/i2p/wrapper.config
50        cp -a pkg-temp/docs debian/tmp/usr/share/i2p/
51        cp -a pkg-temp/eepsite debian/tmp/usr/share/i2p/
52        cp -a pkg-temp/geoip debian/tmp/usr/share/i2p/
53        cp -a pkg-temp/lib/*.jar debian/tmp/usr/share/i2p/lib/
54        cp -a pkg-temp/scripts debian/tmp/usr/share/i2p/
55        cp -a pkg-temp/webapps debian/tmp/usr/share/i2p/
56        cp -a pkg-temp/licenses debian/tmp/usr/share/doc/i2p/
57        @# Create the Debian copyright file
58        cat debian/copyright.part1 LICENSE.txt > debian/tmp/usr/share/doc/i2p/copyright
59        @# delete all license files that are already in /usr/share/common-licenses/
60        rm debian/tmp/usr/share/doc/i2p/licenses/LICENSE-Apache2.0.txt
61        rm debian/tmp/usr/share/doc/i2p/licenses/LICENSE-GPLv2.txt
62        rm debian/tmp/usr/share/doc/i2p/licenses/LICENSE-LGPLv2.1.txt
63
64        @# man pages
65        gzip -9c installer/resources/man/eepget.1 > debian/tmp/usr/share/man/man1/eepget.1.gz
66        gzip -9c installer/resources/man/i2prouter.1 > debian/tmp/usr/share/man/man1/i2prouter.1.gz
67
68        @# copy wrapper files to /usr/lib/i2p (including wrapper.jar because it is architecture dependent)
69        cp ${wrapperpath}/libwrapper.so debian/tmp/usr/lib/i2p/
70        cp ${wrapperpath}/wrapper.jar debian/tmp/usr/lib/i2p/
71        cp ${wrapperpath}/i2psvc debian/tmp/usr/lib/i2p/
72        chmod +x debian/tmp/usr/lib/i2p/i2psvc
73        strip debian/tmp/usr/lib/i2p/libwrapper.so
74        strip debian/tmp/usr/lib/i2p/i2psvc
75
76        @# copy remaining executables to /usr/bin, replace INSTALL_PATH and SYSTEM_java_io_tmpdir
77        sed 's|%INSTALL_PATH|/usr/share/i2p|g' pkg-temp/eepget > debian/tmp/usr/bin/eepget
78        chmod +x debian/tmp/usr/bin/eepget
79        cat pkg-temp/i2prouter | \
80            sed 's|$$I2P/i2psvc|/usr/lib/i2p/i2psvc|g' | \
81            sed 's|$$I2P/wrapper.config|/etc/i2p/wrapper.config|g' | \
82            sed 's|%INSTALL_PATH|/usr/share/i2p|g' | \
83            sed 's|%SYSTEM_java_io_tmpdir|/tmp|g' > debian/tmp/usr/bin/i2prouter
84        chmod +x debian/tmp/usr/bin/i2prouter
85        @# The first 4 sed commands each replace the first \$INSTALL_PATH that hasn't been replaced
86        @# wrapper.java.classpath.1 --> /usr/share/i2p/lib/*.jar:/usr/lib/i2p/wrapper.jar
87        @# wrapper.java.library.path.1 --> /usr/lib/i2p
88        @# wrapper.java.library.path.2 --> /usr/lib/i2p
89        @# i2p.dir.base --> /usr/share/i2p
90        cat pkg-temp/wrapper.config | \
91            sed '0,/$$INSTALL_PATH\/lib\/\*\.jar/s//\/usr\/share\/i2p\/lib\/*.jar\nwrapper.java.classpath.2=\/usr\/lib\/i2p\/wrapper.jar/' | \
92            sed '0,/$$INSTALL_PATH/s//\/usr\/lib\/i2p/' | \
93            sed '0,/$$INSTALL_PATH/s//\/usr\/lib\/i2p/' | \
94            sed '0,/$$INSTALL_PATH/s//\/usr\/share\/i2p/' | \
95            sed 's|$$SYSTEM_java_io_tmpdir|/tmp|g' > debian/tmp/etc/i2p/wrapper.config
96        @# now do runplain.sh
97        cat pkg-temp/runplain.sh | \
98            sed 's|-Djava.library.path=$$I2P:$$I2P/lib|-Djava.library.path=/usr/lib/i2p|g' | \
99            sed 's|%INSTALL_PATH|/usr/share/i2p|g' | \
100            sed 's|%SYSTEM_java_io_tmpdir|/tmp|g' > debian/tmp/usr/share/i2p/runplain.sh
101        chmod +x debian/tmp/usr/share/i2p/runplain.sh
102       
103        dpkg-shlibdeps debian/tmp/usr/lib/i2p/libwrapper.so
104        dpkg-shlibdeps debian/tmp/usr/lib/i2p/i2psvc
105       
106        touch debian/build
107       
108        @# changelog
109        gzip -9c history.txt > debian/tmp/usr/share/doc/i2p/changelog.gz
110        gzip -9c debian/changelog > debian/tmp/usr/share/doc/i2p/changelog.Debian.gz
111
112binary: build
113        mkdir -p debian/tmp/DEBIAN
114        dpkg-gencontrol
115        cp -a debian/scripts/postinst debian/scripts/postrm debian/scripts/prerm debian/conffiles debian/tmp/DEBIAN
116        dpkg-deb -b debian/tmp ..
117
118binary-arch:
119
120binary-indep:
121
122clean:
123        rm -f debian/build
124        rm -rf debian/tmp/
125        ant distclean
126        @exit 0
127
128get-orig-source:
129        wget ${SOURCEURL}
Note: See TracBrowser for help on using the repository browser.