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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
|
#!/usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.
package=cln
package2=cln-dev
version=$(shell expr `pwd` : '.*-\([0-9.]*\)')
#version_major=$(shell expr `pwd` : '.*-\([0-9]*\).[0-9.]*')
curdir=$(shell pwd)
CC := $(shell if [ -x /usr/bin/egcc ]; then echo egcc; else echo cc; fi)
# Create the two so version strings for the symbolic link names
#
command=/usr/lib/dpkg/parsechangelog/debian <debian/changelog
v1 := $(shell $(command) |sed -n '/Version: /s;;;p' |sed -e 's/\..\+//')
v2 := $(shell $(command) |sed -n '/Version: /s;;;p' |sed -e 's/-.\+//')
# don't use v1 because of weird lib name
shl1=lib$(package) $(v1) $(package) (>= $(v2))
build:
$(checkdir)
# remove cached config values
-rm config.cache
# configure with some reasonable values
CC=egcc; CXX="g++ -fno-exceptions"; CFLAGS=-O3; CXXFLAGS=-O ; \
export CC; export CXX; export CFLAGS; export CXXFLAGS; \
./configure --prefix=$(curdir)/debian/tmp/usr \
--host=$(shell dpkg --print-architecture)-pc-linuxelf
# make static and copy the library to source root
$(MAKE) CC=$(CC) CFLAGS="-O3" CXXFLAGS="-O"
cd src; cp -f libcln* ..
# clean up so objects are recompiled for shared
make clean
# make shared lib and copy to source root
$(MAKE) CC=$(CC) CFLAGS="-O3 -fpic" \
ASFLAGS=-fpic CXXFLAGS="-O -fpic" VMAJ=$(v2) shared
cd src; cp -f libcln* ..
touch build
clean:
$(checkdir)
-make distclean
-rm -f src/libmpn/*.o
-rm -f build
-rm -f lib*.so* src/lib*.so.*
-rm -f lib*.a src/lib*.a
-rm -f `find . -name "*~"`
-rm -rf debian/tmp `find debian/* -type d ! -name CVS` debian/files* core
-rm -f debian/*substvars debian/files*
binary-indep: checkroot build
$(checkdir)
binary-arch: checkroot build
$(checkdir)
-rm -rf debian/tmp
# Create new directories in debian/tmp
#
install -d debian/tmp/DEBIAN
install -d debian/tmp/usr/lib
install -d debian/tmp/usr/doc/$(package)
install -d debian/tmp/usr/doc/$(package)/html
-rm -rf debian/tmp/usr/man/dvi
# This was causing a segfault.
# strip --strip-unneeded debian/tmp/usr/lib/libcln.a
# Insert appropriate lines into shlibs file
#
echo -e '$(shl1)\n' >debian/tmp/DEBIAN/shlibs
# Install docs in proper directory and gzip them
#
cp debian/changelog debian/tmp/usr/doc/$(package)/changelog.Debian
cp NEWS debian/tmp/usr/doc/$(package)/changelog
gzip -9v debian/tmp/usr/doc/$(package)/change*
# but don't gzip the copyright statement
#
cp debian/copyright debian/tmp/usr/doc/$(package)/copyright
# Install shared library
#
cp src/lib$(package).so.$(v2) .
strip --strip-unneeded lib$(package).so.$(v2)
install -m 644 lib$(package).so.$(v2) debian/tmp/usr/lib/.
# Create .so link
#
ln -s lib$(package).so.$(v2) debian/tmp/usr/lib/lib$(package).so.$(v1)
# Create dependency information
#
dpkg-shlibdeps lib$(package).so.$(v2)
# Install installation scripts
#
cp debian/postinst.$(package) debian/tmp/DEBIAN/postinst
chmod +x debian/tmp/DEBIAN/postinst
# Generate control file for cln
#
dpkg-gencontrol -p$(package) -isp
# Clean up file ownership
#
chown -R root.root debian/tmp
# and permissions
#
chmod -R g-ws debian/tmp
# and build the package
#
dpkg --build debian/tmp ..
#
# leading ./ is important so that ldd looks at correct binary.
dpkg-shlibdeps ./lib$(package).so.$(v2)
#--------------- Now build cln-dev
# Clean out old tmp directory
#
-rm -rf debian/tmp
# Create new directories in debian/tmp
#
mkdir debian/tmp debian/tmp/DEBIAN
# Create additional installation directories
#
install -d debian/tmp/usr/lib
install -d debian/tmp/usr/info
install -d debian/tmp/usr/doc/$(package2)
install -d debian/tmp/usr/doc/$(package2)/html
install -d debian/tmp/usr/include/$(package)
install -m 644 include/*.h debian/tmp/usr/include/$(package)
# install html , tex , and info
cp doc/*.html debian/tmp/usr/doc/$(package2)/html
chmod 644 debian/tmp/usr/doc/$(package2)/html/*
install -m 644 doc/*.ps doc/*.texi doc/*.tex debian/tmp/usr/doc/$(package2)
install -m 644 doc/$(package).info debian/tmp/usr/info/.
install -d debian/tmp/usr/doc/$(package2)/examples
install -d debian/tmp/usr/doc/$(package2)/examples/include
cp examples/* debian/tmp/usr/doc/$(package2)/examples
cp src/*/*/*.h debian/tmp/usr/doc/$(package2)/examples/include
cp debian/README.examples debian/tmp/usr/doc/$(package2)/examples
# Install docs in proper directory and gzip them
#
install -m 644 README INSTALL debian/tmp/usr/doc/$(package2)/.
cp debian/changelog debian/tmp/usr/doc/$(package2)/changelog.Debian
cp NEWS debian/tmp/usr/doc/$(package2)/changelog
gzip -9v debian/tmp/usr/doc/$(package2)/change*
# but don't gzip the copyright statement
#
cp debian/copyright debian/tmp/usr/doc/$(package2)/copyright
# Install static library
#
strip --strip-debug lib$(package).a
install -m 644 lib$(package).a debian/tmp/usr/lib/.
# Create .so link
#
ln -s lib$(package).so.$(v2) debian/tmp/usr/lib/lib$(package).so
# Install installation scripts
#
cp debian/postinst.$(package2) debian/tmp/DEBIAN/postinst
chmod +x debian/tmp/DEBIAN/postinst
cp debian/prerm.$(package2) debian/tmp/DEBIAN/prerm
chmod +x debian/tmp/DEBIAN/prerm
# Generate control file for cln-dev
#
dpkg-gencontrol -p$(package2) -isp
# Clean up file ownership
#
chown -R root.root debian/tmp
# and permissions
#
chmod -R g-ws debian/tmp
# and build the package
#
dpkg --build debian/tmp ..
define checkdir
test -f debian/rules
endef
binary: binary-indep binary-arch
checkroot:
$(checkdir)
test root = "`whoami`"
.PHONY: binary binary-arch binary-indep clean checkroot
|