123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- #!/usr/bin/make -f
- # Uncomment this to turn on verbose mode.
- #export DH_VERBOSE=1
- include /usr/share/dpatch/dpatch.make
- # These are used for cross-compiling and for saving the configure script
- # from having to guess our platform (since we know it already)
- DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
- DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
- ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
- CROSS= --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \
- CC=$(DEB_HOST_GNU_TYPE)-gcc LD=$(DEB_HOST_GNU_TYPE)-ld
- else
- CROSS= --build=$(DEB_BUILD_GNU_TYPE)
- endif
- # HOWMANY is the number of bytes looked at by file
- CFLAGS = -DHOWMANY=0x18000
- CFLAGS += -Wall -g
- ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -O0
- else
- CFLAGS += -O2
- endif
- PYTHON_VERSIONS=$(shell pyversions -r debian/control)
- config.status: configure patch
- dh_testdir
- rm -f ltmain.sh
- libtoolize --automake
- aclocal
- automake
- autoconf
- # Configuring package
- mv config.sub config.sub.upstream && ln -s /usr/share/misc/config.sub
- mv config.guess config.guess.upstream && ln -s /usr/share/misc/config.guess
- CFLAGS="$(CFLAGS)" ./configure $(CROSS) --prefix=/usr --datadir=\$${prefix}/share --mandir=\$${prefix}/share/man --enable-fsect-man5
- rm config.sub && mv config.sub.upstream config.sub
- rm config.guess && mv config.guess.upstream config.guess
- build: build-stamp
- build-stamp: config.status
- dh_testdir
- # Building package
- mv libtool libtool.upstream && ln -s /usr/bin/libtool libtool
- $(MAKE)
- rm libtool && mv libtool.upstream libtool
- set -e; \
- for python in $(PYTHON_VERSIONS); \
- do \
- (cd python && $$python setup.py build_ext \
- -L$(CURDIR)/src/.libs); \
- done
- set -e; \
- for python in $(PYTHON_VERSIONS); do \
- (cd python && $$python-dbg setup.py build_ext -L$(CURDIR)/src/.libs); \
- done
- touch build-stamp
- clean: unpatch
- dh_testdir
- dh_testroot
- rm -f build-stamp
- # Cleaning package
- [ ! -f Makefile ] || $(MAKE) clean
- [ ! -f Makefile ] || $(MAKE) distclean
- rm -rf python/build
- dh_clean
- install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
- # Installing package
- mv libtool libtool.upstream && ln -s /usr/bin/libtool libtool
- $(MAKE) prefix=$(CURDIR)/debian/tmp/usr install
- rm libtool && mv libtool.upstream libtool
- install -D -m 0644 magic/magic.local debian/tmp/etc/magic
- install -D -m 0644 magic/magic.local debian/tmp/etc/magic.mime
- set -e; \
- for python in $(PYTHON_VERSIONS); \
- do \
- (cd python && $$python setup.py install --no-compile \
- --root=$(CURDIR)/debian/python-magic); \
- done
- set -e; \
- for python in $(PYTHON_VERSIONS); do \
- (cd python && $$python-dbg setup.py install --no-compile \
- --root=$(CURDIR)/debian/python-magic-dbg); \
- done
- find debian/python-*-dbg ! -type d ! -name '*.so' | xargs rm -f
- find debian/python-*-dbg -depth -empty -exec rmdir {} \;
- # Installing additional headers
- mkdir -p debian/libmagic-dev/usr/include/file
- cp src/file.h src/patchlevel.h debian/libmagic-dev/usr/include/file
- # Installing plain magic.mime for compatibility
- install -D -m 0644 debian/legacy/magic.mime debian/libmagic1/usr/share/file/magic.mime
- # Installing bug congtrols
- install -D -m 0644 debian/bug/presubj debian/file/usr/share/bug/file/presubj
- install -D -m 0644 debian/bug/control debian/libmagic1/usr/share/bug/libmagic1/control
- install -D -m 0644 debian/bug/presubj-lib debian/libmagic1/usr/share/bug/libmagic1/presubj
- install -D -m 0644 debian/bug/control debian/libmagic-dev/usr/share/bug/libmagic-dev/control
- binary-indep: build install
- binary-arch: build install
- dh_testdir
- dh_testroot
- dh_installchangelogs ChangeLog
- dh_installdocs
- dh_installexamples
- dh_install --sourcedir=debian/tmp
- dh_lintian
- dh_python
- dh_link
- ifeq (,$(findstring -i, $(DH_OPTIONS)))
- dh_strip -Npython-magic -Npython-magic-dbg
- DH_OPTIONS= dh_strip -ppython-magic --dbg-package=python-magic-dbg
- rm -rf debian/python-magic-dbg/usr/share/doc/python-magic-dbg
- mkdir -p debian/python-magic-dbg/usr/share/doc
- ln -s python-magic debian/python-magic-dbg/usr/share/doc/python-magic-dbg
- endif
- dh_compress
- dh_fixperms
- dh_makeshlibs
- dh_installdeb
- dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib
- dh_gencontrol
- dh_md5sums
- dh_builddeb
- binary: binary-indep binary-arch
- .PHONY: build clean binary-indep binary-arch binary install
|