Theodore Ts'o | 4d8f08f | 2001-05-09 04:51:07 +0000 | [diff] [blame^] | 1 | #! /usr/bin/make -f |
| 2 | # -*- makefile -*- |
| 3 | # |
| 4 | # Invoke each target with `./debian/rules <target>'. All targets should be |
| 5 | # invoked with the package root as the current directory. |
| 6 | # |
| 7 | # The `binary' target must be run as root, as it needs to install files with |
| 8 | # specific ownerships. |
| 9 | |
| 10 | # be paranoid |
| 11 | export LC_ALL=C |
| 12 | |
| 13 | DEB_BUILD_ARCH := $(shell dpkg --print-architecture) |
| 14 | DEB_BUILD_GNU_TYPE := $(shell ./config.guess) |
| 15 | ifndef DEB_HOST_ARCH |
| 16 | DEB_HOST_ARCH := ${DEB_BUILD_ARCH} |
| 17 | endif |
| 18 | DEB_HOST_GNU_CPU := $(patsubst hurd-%,%,$(DEB_HOST_ARCH)) |
| 19 | ifeq ($(filter-out hurd-%,${DEB_HOST_ARCH}),) |
| 20 | DEB_HOST_GNU_SYSTEM := gnu |
| 21 | else |
| 22 | # FIXME: we won't always have only Hurd and Linux |
| 23 | DEB_HOST_GNU_SYSTEM := linux |
| 24 | endif |
| 25 | DEB_HOST_GNU_TYPE := ${DEB_HOST_GNU_CPU}-${DEB_HOST_GNU_SYSTEM} |
| 26 | |
| 27 | |
| 28 | # find the version for the main package, from changelog file |
| 29 | MAIN_VERSION = $(shell head -1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g') |
| 30 | # find versions for libraries going into their own packages, from their Makefile.in's |
| 31 | COMERR_VERSION = $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3) |
| 32 | COMERR_MAJOR = $(word 1,$(subst ., ,${COMERR_VERSION})) |
| 33 | SS_VERSION = $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3) |
| 34 | SS_MAJOR = $(word 1,$(subst ., ,${SS_VERSION})) |
| 35 | UUID_VERSION = $(shell grep ELF_VERSION lib/uuid/Makefile.in | cut '-d ' -f3) |
| 36 | UUID_MAJOR = $(word 1,$(subst ., ,${UUID_VERSION})) |
| 37 | |
| 38 | package=e2fsprogs |
| 39 | |
| 40 | topdir=$(shell pwd) |
| 41 | debdir=${topdir}/debian |
| 42 | maindir=${debdir}/tmp |
| 43 | builddir=${debdir}/BUILD |
| 44 | docdir=${maindir}/usr/share/doc/${package} |
| 45 | MANDIR=/usr/share/man |
| 46 | mandir=${maindir}${MANDIR} |
| 47 | |
| 48 | SUBPACKAGES_DIRS = tmp e2fslibs-dev comerr-dev ss-dev |
| 49 | |
| 50 | installdoc = install -m 644 |
| 51 | installbin = install -m 755 |
| 52 | |
| 53 | CCOPTS = -g -O2 -fsigned-char |
| 54 | LIBC-DEV = libc6-dev |
| 55 | |
| 56 | ifeq (${DEB_HOST_ARCH},alpha) |
| 57 | CCOPTS += -DHAVE_NETINET_IN_H |
| 58 | LIBC-DEV = libc6.1-dev |
| 59 | else |
| 60 | CCOPTS += -D__NO_STRING_INLINES |
| 61 | endif |
| 62 | |
| 63 | build: build-stamp |
| 64 | build-stamp: configure-stamp |
| 65 | dh_testdir |
| 66 | make -C ${builddir} |
| 67 | ( cd ${builddir}/doc && \ |
| 68 | texi2html -split_chapter ${topdir}/doc/libext2fs.texinfo ) |
| 69 | ( cd ${builddir}/lib/et && make com_err.info && \ |
| 70 | texi2html -split_chapter -expandinfo ${topdir}/lib/et/com_err.texinfo ) |
| 71 | touch build-stamp |
| 72 | |
| 73 | configure-stamp: |
| 74 | dh_testdir |
| 75 | mkdir -p ${builddir} |
| 76 | ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) |
| 77 | cd ${builddir} && CFLAGS="${CFLAGS}" \ |
| 78 | ${topdir}/configure --with-ccopts="${CCOPTS}" \ |
| 79 | --enable-elf-shlibs --enable-dynamic-e2fsck \ |
| 80 | --enable-nls --enable-compression \ |
| 81 | --mandir=${MANDIR} --infodir=/usr/share/info |
| 82 | else |
| 83 | cd ${builddir} && CFLAGS="${CFLAGS}" CC="${DEB_HOST_GNU_TYPE}-gcc" \ |
| 84 | ${topdir}/configure --with-ccopts="${CCOPTS}" \ |
| 85 | --enable-elf-shlibs --enable-dynamic-e2fsck \ |
| 86 | --enable-nls --enable-compression \ |
| 87 | --mandir=${MANDIR} --infodir=/usr/share/info \ |
| 88 | --build=$(DEB_BUILD_GNU_TYPE) $(DEB_HOST_GNU_TYPE) |
| 89 | endif |
| 90 | touch configure-stamp |
| 91 | |
| 92 | clean: |
| 93 | dh_testdir |
| 94 | rm -f build-stamp configure-stamp install |
| 95 | -make -C ${builddir} -i distclean |
| 96 | rm -rf ${builddir} |
| 97 | rm -f doc/libext2fs_*.html lib/et/com_err_*.html |
| 98 | dh_clean |
| 99 | |
| 100 | binary-indep: build |
| 101 | # no arch-independant debs. |
| 102 | |
| 103 | binary-arch: build |
| 104 | dh_testversion 0.56 # == 0.53 + fixes |
| 105 | dh_testdir -a |
| 106 | dh_testroot -a |
| 107 | dh_clean -a |
| 108 | dh_installdirs -a |
| 109 | |
| 110 | mkdir -p ${maindir}/sbin |
| 111 | make -C ${builddir} install DESTDIR=${maindir} |
| 112 | # static libs and .h files |
| 113 | make -C ${builddir} install-libs DESTDIR=${maindir} |
| 114 | |
| 115 | # correct locations |
| 116 | (cd ${maindir}/sbin && mv debugfs ../usr/sbin/) |
| 117 | (cd ${maindir}/sbin && mv e2label ../usr/sbin/) |
| 118 | |
| 119 | # docs |
| 120 | # fully handled by debhelper |
| 121 | rm -rf ${maindir}/usr/share/info |
| 122 | |
| 123 | mkdir -p ${debdir}/e2fslibs-dev/usr/share/doc/e2fsprogs |
| 124 | ln -sf e2fsprogs ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev |
| 125 | |
| 126 | mkdir -p ${maindir}/usr/share/doc/libcomerr${COMERR_MAJOR} |
| 127 | mkdir -p ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_MAJOR} |
| 128 | ln -sf libcomerr${COMERR_MAJOR} ${debdir}/comerr-dev/usr/share/doc/comerr-dev |
| 129 | |
| 130 | mkdir -p ${maindir}/usr/share/doc/libss${SS_MAJOR} |
| 131 | mkdir -p ${debdir}/ss-dev/usr/share/doc/libss${SS_MAJOR} |
| 132 | ln -sf libss${SS_MAJOR} ${debdir}/ss-dev/usr/share/doc/ss-dev |
| 133 | |
| 134 | mkdir -p ${debdir}/uuid-dev/usr/share/doc/e2fsprogs |
| 135 | ln -sf e2fsprogs ${debdir}/uuid-dev/usr/share/doc/uuid-dev |
| 136 | |
| 137 | dh_installdocs -a |
| 138 | |
| 139 | for i in libcomerr${COMERR_MAJOR} libss${SS_MAJOR}; do \ |
| 140 | install -m 644 debian/$$i.copyright ${maindir}/usr/share/doc/$$i/copyright ;\ |
| 141 | done |
| 142 | |
| 143 | # HTML docs |
| 144 | install -d ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/html-info/ |
| 145 | install -p ${builddir}/doc/libext2fs_*.html \ |
| 146 | ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/html-info/ |
| 147 | install -d ${debdir}/comerr-dev/usr/share/doc/comerr-dev/html-info/ |
| 148 | install -p ${builddir}/lib/et/com_err_*.html \ |
| 149 | ${debdir}/comerr-dev/usr/share/doc/comerr-dev/html-info/ |
| 150 | |
| 151 | # texinfo docs |
| 152 | install -p ${topdir}/doc/libext2fs.texinfo \ |
| 153 | ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/libext2fs.texi |
| 154 | install -p ${topdir}/lib/et/com_err.texinfo \ |
| 155 | ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_MAJOR}/com_err.texi |
| 156 | |
| 157 | # info docs |
| 158 | # dh_installinfo -pcomerr-dev ${builddir}/lib/et/com_err.info |
| 159 | dh_installinfo -pe2fslibs-dev ${builddir}/doc/libext2fs.info |
| 160 | |
| 161 | # examples |
| 162 | dh_installexamples -a |
| 163 | |
| 164 | # dh_installmanpages still makes a mess as of 0.54 (see below dh_movefiles) |
| 165 | ln -s e2fsck.8 ${mandir}/man8/fsck.ext2.8 |
| 166 | ln -s mke2fs.8 ${mandir}/man8/mkfs.ext2.8 |
| 167 | |
| 168 | dh_movefiles -a |
| 169 | # cleanup empty dirs |
| 170 | cd ${maindir}/usr/include/ && rmdir * && cd .. && rmdir include/ |
| 171 | cd ${maindir}/usr/share/ && rmdir et ss && cd man && rmdir man3 |
| 172 | cd ${maindir}/usr && rmdir lib |
| 173 | |
| 174 | # broken + useless in 0.52 |
| 175 | # dh_installmanpages -a |
| 176 | |
| 177 | dh_undocumented -a |
| 178 | |
| 179 | dh_installchangelogs -pe2fsprogs ChangeLog |
| 180 | for i in libcomerr${COMERR_MAJOR} libss${SS_MAJOR}; do \ |
| 181 | ln -s ../e2fsprogs/changelog.Debian.gz ${maindir}/usr/share/doc/$$i/ ;\ |
| 182 | ln -s ../e2fsprogs/changelog.gz ${maindir}/usr/share/doc/$$i/ ;\ |
| 183 | done |
| 184 | |
| 185 | dh_strip -a |
| 186 | dh_compress -a |
| 187 | dh_fixperms -a |
| 188 | |
| 189 | echo "libcdev:Depends=${LIBC-DEV}" >> debian/comerr-dev.substvars |
| 190 | echo "libcdev:Depends=${LIBC-DEV}" >> debian/ss-dev.substvars |
| 191 | echo "libcdev:Depends=${LIBC-DEV}" >> debian/uuid-dev.substvars |
| 192 | echo "libcdev:Depends=${LIBC-DEV}" >> debian/e2fslibs-dev.substvars |
| 193 | |
| 194 | dh_installdeb -a |
| 195 | LD_LIBRARY_PATH=${builddir}/lib:/lib:/usr/lib \ |
| 196 | dh_shlibdeps -a |
| 197 | dh_gencontrol -pe2fsprogs -pe2fslibs-dev |
| 198 | dh_gencontrol -pcomerr-dev \ |
| 199 | -u '-v${COMERR_VERSION}-${MAIN_VERSION}' |
| 200 | dh_gencontrol -pss-dev \ |
| 201 | -u '-v${SS_VERSION}-${MAIN_VERSION}' |
| 202 | dh_gencontrol -puuid-dev \ |
| 203 | -u '-v${UUID_VERSION}-${MAIN_VERSION}' |
| 204 | # We do this one by hand |
| 205 | # dh_makeshlibs -a |
| 206 | dh_md5sums -a |
| 207 | dh_builddeb -a |
| 208 | |
| 209 | binary: binary-indep binary-arch |
| 210 | |
| 211 | .PHONY: binary binary-arch binary-indep clean checkroot |