rules 3.11 KB
Newer Older
1
#!/usr/bin/make -f
2 3
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

4
CFLAGS   := $(shell dpkg-buildflags --get CFLAGS)
5
CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS)
6 7 8
CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS)
LDFLAGS  := $(shell dpkg-buildflags --get LDFLAGS)

9
export CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
10

11
XCFLAGS = -Wall -Wunused -Wno-format-y2k -fPIE -fno-strict-aliasing
12

13
DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
14 15
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
libdir = /usr/lib/$(DEB_HOST_MULTIARCH)
16

Aaron M. Ucko's avatar
Aaron M. Ucko committed
17 18 19 20
%:
	dh $@

override_dh_auto_configure:
21
	mv fltk.spec fltk.spec.saved
22 23
	dh_auto_configure -- CC="$(CC)" CXX="$(CXX)" \
            DSOFLAGS="$(filter-out -fPIE -pie,$(LDFLAGS))" \
24 25
	    --enable-shared --enable-threads --enable-xft \
	    --enable-xinerama --without-links --libdir=$(libdir)
26
	mv fltk.spec.saved fltk.spec
Aaron M. Ucko's avatar
Aaron M. Ucko committed
27 28

override_dh_auto_build:
29 30 31 32
	dh_auto_build     -- OPTIM="$(CFLAGS) $(XCFLAGS)" STRIP=@:
# documentation/Makefile ignores errors from htmldoc, so this command
# should be safe to run unconditionally.
	$(MAKE) -C documentation fltk.pdf fltk.ps
33

34 35 36 37 38
override_dh_auto_clean:
	mv fltk.spec fltk.spec.saved
	dh_auto_clean
	mv fltk.spec.saved fltk.spec

Aaron M. Ucko's avatar
Aaron M. Ucko committed
39
override_dh_clean:
40
	dh_clean debian/libfltk1.1.symbols.$(DEB_HOST_ARCH)
41

42
override_dh_auto_install-arch:
Aaron M. Ucko's avatar
Aaron M. Ucko committed
43
	dh_auto_install
44
	mkdir -p debian/tmp/usr/games
45
	mkdir -p debian/tmp/usr/lib/fltk
46
	mkdir -p debian/tmp/usr/share/applications
47 48 49 50
	mkdir -p debian/tmp/usr/share/icons/hicolor/32x32/apps
	mkdir -p debian/tmp/usr/share/icons/hicolor/128x128/apps
	mkdir -p debian/tmp/usr/share/man/man6
	mkdir -p debian/tmp/usr/share/pixmaps
51
## fltk1.1-games (installed by hand to be able to add fl prefixes.)
52 53 54 55
	for game in blocks checkers sudoku; do \
	    cp test/$$game debian/tmp/usr/games/fl$$game && \
	    sed -e 's,Exec=,&/usr/games/fl,; s,Icon=,&fl,; s,Name=,&FLTK ,' \
	      test/desktop/$$game.desktop \
56
	      >debian/tmp/usr/share/applications/fl$$game.desktop && \
57 58 59 60 61
	    cp test/desktop/$$game-32.png \
	      debian/tmp/usr/share/icons/hicolor/32x32/apps/fl$$game.png && \
	    cp test/desktop/$$game-128.png \
	      debian/tmp/usr/share/icons/hicolor/128x128/apps/fl$$game.png && \
	    sed -e '1s,^\.TH ,&fl,; 3s,^,fl,' documentation/$$game.man \
62
	      >debian/tmp/usr/share/man/man6/fl$$game.6 \
63 64
	    || exit 1; \
	done
65
## libfltk1.1-dev
66 67 68
	cp CMake/FLTKUse.cmake debian/CMakeCache.txt debian/tmp/usr/lib/fltk
	sed 's,@libdir@,$(libdir),' debian/FLTKConfig.cmake.in \
	    >debian/tmp/usr/lib/fltk/FLTKConfig.cmake
69 70 71 72 73 74 75

override_dh_install-arch:
## libfltk1.1-dev
	sed -e 's/ -fdebug-prefix-map=[^ ]*=\. / /' fltk-config \
	    > debian/tmp/usr/bin/fltk-config
	chmod +x debian/tmp/usr/bin/fltk-config
	dh_install
76

Aaron M. Ucko's avatar
Aaron M. Ucko committed
77 78
override_dh_installdocs:
	dh_installdocs -A CREDITS README
79

80
override_dh_makeshlibs-arch:
Aaron M. Ucko's avatar
Aaron M. Ucko committed
81 82 83
# On most Debian architectures, 1.1.9-3 was the first version to build
# with GCC 4.3, which proceeded to introduce a few new symbols.  On
# alpha, however, 4.2 remained the default through lenny's release.
84
ifeq ($(DEB_HOST_ARCH),alpha)
Aaron M. Ucko's avatar
Aaron M. Ucko committed
85
	sed -e 's/1\.1\.9-3~/1.1.10~rc2/' debian/libfltk1.1.symbols \
86 87
	  > debian/libfltk1.1.symbols.$(DEB_HOST_ARCH)
endif
Aaron M. Ucko's avatar
Aaron M. Ucko committed
88
	dh_makeshlibs  -V