File: rules

package info (click to toggle)
camlimages 2.20-8
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 4,016 kB
  • ctags: 2,436
  • sloc: ml: 12,244; ansic: 2,402; makefile: 1,148; sh: 203
file content (123 lines) | stat: -rwxr-xr-x 3,182 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f

include /usr/share/dpatch/dpatch.make

BUILD_LABLGTK2=yes
BUILD_LABLGTK =no

OCAMLIBDIR := $(shell ocamlc -where)
OCAMLABI=$(shell ocamlc -version)

ifeq ($(BUILD_LABLGTK2),yes)
LABLGTK2_DIR := $(shell ocamlfind query lablgtk2)
LABGTK2_CONF  = --with-labgtk2=$(LABGTK2_DIR)
else
LABGTK2_CONF  = --without-labgtk2
endif

ifeq ($(BUILD_LABLGTK),yes)
LABLGTK_DIR := $(shell ocamlfind query lablgtk)
LABGTK_CONF  = --with-labgtk=$(LABGTK_DIR)
else
LABGTK_CONF  = --without-labgtk
endif

DESTDIR = $(CURDIR)/debian/libcamlimages-ocaml
DESTDIR_DEV = $(CURDIR)/debian/libcamlimages-ocaml-dev
DESTDIR_DOC = $(CURDIR)/debian/libcamlimages-ocaml-doc

debian/control: debian/control.in
	 sed -e 's%#OCamlABI#%$(OCAMLABI)%' $@.in >$@

configure: configure-stamp
configure-stamp: patch-stamp
	dh_testdir
	./configure $(LABLGTK_CONF) $(LABLGTK2_CONF)
	touch configure-stamp

build: build-stamp
build-stamp: configure-stamp patch-stamp
	dh_testdir
	$(MAKE) byt
	if [ -x /usr/bin/ocamlopt ] || [ -x /usr/bin/ocamlopt.opt ]; then \
		$(MAKE) opt; \
	fi
	touch build-stamp

clean: unpatch
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp
	# Clean documentation links
	-test -L html && $(RM) html
	-test -L doc/index.html && $(RM) doc/index.html
	-$(MAKE) veryclean
	-$(RM) Makefile.config
	-$(RM) -r freetype
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	# Creating install dirs
	mkdir -p $(DESTDIR_DEV)/$(OCAMLIBDIR)/camlimages
	mkdir -p $(DESTDIR_DEV)/$(OCAMLIBDIR)/METAS
	mkdir -p $(DESTDIR)/$(OCAMLIBDIR)/stublibs
	# Install
	$(MAKE) install.byt DESTDIR=$(DESTDIR_DEV)
	if [ -x /usr/bin/ocamlopt ]; then \
		$(MAKE) install.opt DESTDIR=$(DESTDIR_DEV); \
	fi
	# Move the file to their correct destination
	mv -f $(DESTDIR_DEV)/$(OCAMLIBDIR)/camlimages/*.so \
	 $(DESTDIR)/$(OCAMLIBDIR)/stublibs/
	cp debian/META \
	 $(DESTDIR_DEV)/$(OCAMLIBDIR)/METAS/META.camlimages
	# Remove the rpath
	chrpath -d $(DESTDIR)/$(OCAMLIBDIR)/stublibs/*.so

binary-indep: build install
	dh_testdir -i
	dh_testroot -i
	dh_link -i
	# Set up documentation links
	# Install documentation
	cp -rf doc/* \
	 $(DESTDIR_DOC)/usr/share/doc/libcamlimages-ocaml-doc/html
	$(RM) $(DESTDIR_DOC)/usr/share/doc/libcamlimages-ocaml-doc/html/LICENSE
	$(RM) $(DESTDIR_DOC)/usr/share/doc/libcamlimages-ocaml-doc/html/README
	$(RM) $(DESTDIR_DOC)/usr/share/doc/libcamlimages-ocaml-doc/html/INSTALL
	dh_installdocs -i
	dh_installchangelogs -i CHANGES
	dh_installexamples -i
	# remove Makefile and .depend files (because they are relative to source
	# tree of camlimages)
	-find \
		debian/libcamlimages-ocaml-doc \
		\( -name .depend -or -name Makefile \) -exec rm {} \;
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -a
	dh_installchangelogs -a CHANGES
	dh_link -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a -- -VF:OCamlABI="$(OCAMLABI)"
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure debian/control