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
|
#!/usr/bin/make -f
SONAME=3
SOVERSION=${SONAME}.1
LDEBDIR = debian/tmp/DEBIAN
LLIBDIR = debian/tmp/usr/lib
LDOCDIR = debian/tmp/usr/share/doc/ftplib${SONAME}
DDEBDIR = debian/tmp-dev/DEBIAN
DLIBDIR = debian/tmp-dev/usr/lib
DINCDIR = debian/tmp-dev/usr/include
DDOCDIR = debian/tmp-dev/usr/share/doc/ftplib-dev
DEXMDIR = debian/tmp-dev/usr/share/doc/ftplib-dev/examples
DMANDIR = debian/tmp-dev/usr/share/man
DMENUDIR = debian/tmp-dev/usr/lib/menu
ifneq (,$(findstring debug,${DEB_BUILD_OPTIONS}))
DEBUG = -g -O2
else
DEBUG = -O2
endif
ifeq (,$(findstring nostrip,${DEB_BUILD_OPTIONS}))
STRIP = strip
else
STRIP = :
endif
build:
$(checkdir)
cd linux && make DEBUG="${DEBUG}"
touch build
clean:
$(checkdir)
-rm -f build
# Assume that if the makefile doesn't exist, it was deleted by a previous
# "make clobber" so there's no need to repeat it.
-cd linux && make clobber
-rm -f `find . -name "*~"` debian/files* debian/substvars
-rm -rf debian/tmp debian/tmp-dev debian/tmp-man
binary-indep:
binary-arch: build
$(checkdir)
-rm -rf debian/tmp debian/tmp-dev
# Make sure we agree with the package about the soname and version to use.
test -f linux/libftp.so.${SOVERSION}
test -L linux/libftp.so.${SONAME}
# Library package
# shared library
install -d ${LLIBDIR}
install -m 644 linux/libftp.so.${SOVERSION} ${LLIBDIR}
${STRIP} --strip-unneeded ${LLIBDIR}/libftp.so.${SOVERSION}
ln -s libftp.so.${SOVERSION} ${LLIBDIR}/libftp.so.${SONAME}
# documentation
install -d ${LDOCDIR}
install -p -m 644 CHANGES ${LDOCDIR}/changelog
install -m 644 debian/changelog ${LDOCDIR}/changelog.Debian
gzip -9 ${LDOCDIR}/*
install -m 644 debian/copyright ${LDOCDIR}
# control files
install -d ${LDEBDIR}
install -p -m 644 debian/shlibs.local ${LDEBDIR}/shlibs
# fill in package name at install time, because it depends on SONAME.
sed s/##PACKAGE##/ftplib${SONAME}/g <debian/postinst.ftplib >debian/postinst.tmp
sed s/##PACKAGE##/ftplib${SONAME}/g <debian/prerm.ftplib >debian/prerm.tmp
install -m 755 debian/postinst.tmp ${LDEBDIR}/postinst
install -m 755 debian/prerm.tmp ${LDEBDIR}/prerm
rm -f debian/postinst.tmp
rm -f debian/prerm.tmp
dpkg-shlibdeps ${LLIBDIR}/libftp.so.${SOVERSION}
dpkg-gencontrol -isp -Vsoname=${SONAME} -pftplib${SONAME} -Pdebian/tmp
dpkg --build debian/tmp ..
# Development package
# library
install -d ${DLIBDIR}
ln -s libftp.so.${SOVERSION} ${DLIBDIR}/libftp.so
install -m 644 linux/libftp.a ${DLIBDIR}
${STRIP} --strip-debug ${DLIBDIR}/libftp.a
# include files
install -d ${DINCDIR}
install -p -m 644 linux/ftplib.h ${DINCDIR}
# documentation
install -d ${DDOCDIR}
install -p -m 644 README.ftplib_v3.1 ${DDOCDIR}
install -p -m 644 debian/README ${DDOCDIR}/README.Debian
install -p -m 644 CHANGES ${DDOCDIR}/changelog
install -p -m 644 TODO ${DDOCDIR}
install -m 644 debian/changelog ${DDOCDIR}/changelog.Debian
gzip -9f ${DDOCDIR}/*
install -m 644 debian/copyright ${DDOCDIR}
install -d ${DDOCDIR}/html
install -p -m 644 html/* ${DDOCDIR}/html
rm ${DDOCDIR}/html/model.html
# menu entry for html documentation
install -d ${DMENUDIR}
install -p -m 644 debian/menu ${DMENUDIR}/ftplib-dev
# examples
install -d ${DEXMDIR}
install -p -m 644 README.qftp ${DEXMDIR}
install -p -m 644 linux/qftp.c ${DEXMDIR}
install -m 755 -s linux/qftp ${DEXMDIR}
ln -s qftp ${DEXMDIR}/ftpdir
ln -s qftp ${DEXMDIR}/ftpget
ln -s qftp ${DEXMDIR}/ftpsend
ln -s qftp ${DEXMDIR}/ftprm
ln -s qftp ${DEXMDIR}/ftplist
install -p -m 644 debian/Makefile.examples ${DEXMDIR}/Makefile
# man pages
mkdir debian/tmp-man
install -d ${DMANDIR}/man3
python debian/html2man.py html/Ftp*.html debian/tmp-man
set -e; for i in debian/tmp-man/* ; do install -m 644 $$i ${DMANDIR}/man3; done
gzip -9 ${DMANDIR}/man3/*.3
# control files
install -d ${DDEBDIR}
install -m 755 debian/postinst.ftplib-dev ${DDEBDIR}/postinst
install -m 755 debian/prerm.ftplib-dev ${DDEBDIR}/prerm
install -m 755 debian/postrm.ftplib-dev ${DDEBDIR}/postrm
# If this host does not have ftplib installed, we will get a warning
# here that libftp was not found. The warning can be ignored because
# we already have an explicit dependency on the ftplib package.
dpkg-shlibdeps ${DEXMDIR}/qftp
dpkg-gencontrol -isp -Vsoname=${SONAME} -pftplib-dev -Pdebian/tmp-dev
dpkg --build debian/tmp-dev ..
define checkdir
test -f ftplib.lsm -a -f debian/rules
endef
binary: binary-indep binary-arch
.PHONY: binary binary-arch binary-indep clean checkroot
|