Invoke ./configure with correct --build argument.
[wmaker-crm.git] / debian / rules
blob63e43e40689a5a5d8f08f55071473fa211f2c6d2
1 #!/usr/bin/make -f
2 # GNU Copyright 1997-2005 Marcelo Magallon <mmagallo@debian.org>
4 package := wmaker
5 version := $(shell dpkg-parsechangelog | grep-dctrl -ne -sVersion -FVersion .)
7 # use '(>= some_version)' whenever version dependencies are needed
8 # libwraster_deps := (>= 0.90.0-1)
10 SHELL=/bin/sh
12 CFLAGS = -g -Wall -DGLOBAL_DEFAULTS_SUBDIR="\\\"GNUstep/Defaults\\\""
14 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
15 CFLAGS += -O0
16 else
17 CFLAGS += -O2
18 endif
20 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
21 CFLAGS += -DDEBUG
22 endif
24 # These are used for cross-compiling and for saving the configure script
25 # from having to guess our platform (since we know it already)
26 export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
27 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
29 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
30 HOSTSPEC := --build $(DEB_HOST_GNU_TYPE)
31 else
32 HOSTSPEC := --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
33 endif
37 LINGUAS := $(patsubst po/%.po, %, $(wildcard po/*.po))
38 #LINGUAS := $(filter-out zh_TW.Big5, $(LINGUAS))
40 XLOCALE := --disable-locale
41 MODELOCK := --enable-modelock
43 XINERAMA := --enable-xinerama
45 # USERMENU := --enable-usermenu
47 # SHAPE_EXT := --disable-shape
48 # USE_SHM := --disable-shm
50 # USE_XPM := --disable-xpm
51 # USE_PNG := --disable-png
52 # USE_JPEG := --disable-jpeg
53 # USE_GIF := --disable-gif
54 # USE_TIFF := --disable-tiff
56 WMAKER_OPTIONS := $(XLOCALE) $(MODELOCK) $(XINERAMA) \
57 $(USERMENU) $(SHAPE_EXT) $(USE_SHM) \
58 $(USE_XPM) $(USE_PNG) $(USE_JPEG) $(USE_GIF) $(USE_TIFF) \
59 $(HOSTSPEC)
61 TOPSRCDIR := $(shell pwd)
62 DEBTMPDIR := $(TOPSRCDIR)/debian/wmaker
64 WMAKER := wmaker
65 WMAKER_BD := $(TOPSRCDIR)/$(WMAKER)
66 WMAKER_TMP := $(DEBTMPDIR)
68 # Be careful with the leading / because some of these values are going
69 # to be hardcoded into the executables
71 BASEDIR := /usr
72 CONFDIR := /etc
73 BINDIR := $(BASEDIR)/bin
74 INCLUDEDIR := $(BASEDIR)/include
75 SHAREDIR := $(BASEDIR)/share
76 DOCDIR := $(SHAREDIR)/doc
77 MANDIR := $(SHAREDIR)/man
78 MAN1DIR := $(MANDIR)/man1
79 MAN8DIR := $(MANDIR)/man8
80 LIBDIR := $(BASEDIR)/lib
81 PKGLIBDIR := $(BASEDIR)/lib/WindowMaker
82 NLSDIR := $(SHAREDIR)/locale
83 WMCONFDIR := $(CONFDIR)/X11/WindowMaker
84 WMSHAREDIR := $(SHAREDIR)/WindowMaker
85 WMDOCDIR := $(DOCDIR)/wmaker
86 GNUSTEPDIR := $(LIBDIR)/GNUstep/System
87 GNUSTEPCONFDIR := $(CONFDIR)/GNUstep
88 DEFAULTSDIR := $(GNUSTEPCONFDIR)/Defaults
89 PIXMAPDIR := $(INCLUDEDIR)/X11/pixmaps
90 GNUSTEPAPPS := $(GNUSTEPDIR)/Applications
91 WPREFSAPPDIR := $(GNUSTEPAPPS)/WPrefs.app
93 WPREFSSRCDIR := $(TOPSRCDIR)/WPrefs.app
94 WRASTERSRCDIR := $(TOPSRCDIR)/wrlib
95 WINGSSRCDIR := $(TOPSRCDIR)/WINGs
97 LIBWRASTER := libwraster3
98 LIBWRASTER_TMP := $(DEBTMPDIR)/../$(LIBWRASTER)
99 LIBWINGS := libwings-dev
100 LIBWINGS_TMP := $(DEBTMPDIR)/../$(LIBWINGS)
102 RM := rm -f
103 RMDIR := rmdir --ignore-fail-on-non-empty
105 COMMON_OPTIONS := --prefix=$(BASEDIR) \
106 --mandir=$(MANDIR) \
107 --includedir=$(INCLUDEDIR) \
108 --sysconfdir=$(CONFDIR) \
109 --datadir=$(SHAREDIR) \
110 --with-nlsdir=$(NLSDIR) \
111 --with-pixmapdir=$(PIXMAPDIR) \
112 --with-gnustepdir=$(GNUSTEPDIR) \
113 --with-xft
115 LIST_PATCHES := find debian/patches -mindepth 1 -maxdepth 1 -name \*.diff -type f | sort
116 RLIST_PATCHES := find debian/patches -mindepth 1 -maxdepth 1 -name \*.diff -type f | sort -r
118 install_file := install -p -o root -g root -m 0644
119 install_prog := install -p -o root -g root -m 0755
120 install_dir := install -p -d -o root -g root -m 0755
122 build: build-stamp
123 build-stamp: build-wmaker-stamp
124 touch $@
126 build-wmaker-stamp: config-wmaker-stamp
127 $(RM) $(patsubst %.in,%,$(shell find WindowMaker -name \*.in ! -name Makefile.in))
128 test -x libtool || ln -sf $(WMAKER_BD)/libtool .
129 $(MAKE) -C $(WMAKER_BD)
130 touch $@
132 config-wmaker-stamp: patch-wmaker-stamp configure
133 dh_testdir
134 test -x config.guess || chmod +x config.guess
135 test -x config.sub || chmod +x config.sub
136 find -name \*.h.in | sed -e 's/\.in$$//' | xargs -r rm -f
137 mkdir -p $(WMAKER_BD)
138 cd $(WMAKER_BD) && \
139 LINGUAS="$(LINGUAS)" $(TOPSRCDIR)/configure $(COMMON_OPTIONS) \
140 $(WMAKER_OPTIONS) CFLAGS="$(CFLAGS)"
141 touch $@
143 patch-wmaker-stamp:
144 @$(LIST_PATCHES) | \
145 while read patch ; do \
146 echo $$patch ; \
147 if head -1 $$patch | grep -q ^Index: ; then \
148 patch -p0 < $$patch ; \
149 else \
150 patch -p1 < $$patch ; \
151 fi ; \
152 echo ; \
153 done
154 touch $@
156 test-patch-wmaker:
157 @$(LIST_PATCHES) | \
158 while read patch ; do \
159 echo $$patch ; \
160 if head -1 $$patch | grep -q ^Index: ; then \
161 patch --dry-run -p0 < $$patch ; \
162 else \
163 patch --dry-run -p1 < $$patch ; \
164 fi ; \
165 echo ; \
166 done
168 unpatch-wmaker:
169 @if [ -e patch-wmaker-stamp ] ; then \
170 $(RLIST_PATCHES) | \
171 while read patch ; do \
172 echo $$patch ; \
173 if head -1 $$patch | grep -q ^Index: ; then \
174 patch -p0 -R < $$patch ; \
175 else \
176 patch -p1 -R < $$patch ; \
177 fi ; \
178 echo ; \
179 done ; \
180 rm patch-wmaker-stamp ; \
183 clean:
184 dh_testdir
185 dh_testroot
186 $(RM) -r $(WMAKER_BD)
187 $(RM) *-stamp \
188 debian/*.files \
189 debian/shlibs.local \
190 debian/conffiles
191 debian/rules unpatch-wmaker
192 dh_clean
194 binary-indep: build
195 # dh_testdir -i
196 # dh_testroot
197 # dh_clean -i -k
199 binary-arch: build
200 dh_testdir -a
201 dh_testroot
202 dh_clean -a -k
203 dh_installdirs -a
204 debian/rules install-wmaker-stamp
205 debian/rules debian/$(LIBWRASTER)-dev.files
206 debian/rules debian/$(LIBWRASTER).files
207 debian/rules debian/$(LIBWINGS).files
208 dh_movefiles -a --sourcedir=debian/wmaker
209 # Remove cruft
210 $(RM) $(DEBTMPDIR)/usr/bin/wkdemenu.pl
211 # deal with menus
212 dh_installmenu -a --noscripts
213 $(install_prog) debian/appearance.menu-method \
214 $(DEBTMPDIR)/etc/menu-methods/wmappearance
215 $(install_file) WindowMaker/appearance.menu \
216 $(DEBTMPDIR)/$(WMCONFDIR)/
217 $(install_file) WindowMaker/background.menu \
218 $(DEBTMPDIR)/$(WMCONFDIR)/
219 $(install_file) WindowMaker/wmmacros \
220 $(DEBTMPDIR)/$(WMCONFDIR)/
221 touch $(DEBTMPDIR)/$(WMCONFDIR)/menu.prehook
222 touch $(DEBTMPDIR)/$(WMCONFDIR)/menu.posthook
223 $(install_file) debian/wmaker.desktop $(DEBTMPDIR)/usr/share/xsessions
224 # build a conffiles list AFTER installing the menus
225 # the sed part is there because of policy
226 # -cd $(DEBTMPDIR) && \
227 # find etc ! -type d \
228 # | sed -e "s:^etc/:/etc/:" > ../conffiles
229 dh_installdocs -a
230 $(install_file) $(WINGSSRCDIR)/README \
231 $(LIBWINGS_TMP)/$(DOCDIR)/$(LIBWINGS)/README.WINGs
232 $(install_file) $(WRASTERSRCDIR)/README \
233 $(LIBWRASTER_TMP)/$(DOCDIR)/$(LIBWRASTER)/README.wrlib
234 $(install_dir) $(DEBTMPDIR)/$(MAN1DIR)
235 $(RM) $(DEBTMPDIR)/$(MAN1DIR)/convertstyle*
236 dh_installman -pwmaker debian/manpages/*.1x
237 dh_installman -pwmaker debian/manpages/*.8
238 dh_installman -plibwraster3-dev debian/manpages/get-wraster-flags.1
239 dh_installman -plibwings-dev debian/manpages/get-wings-flags.1
240 dh_installman -plibwings-dev debian/manpages/get-wutil-flags.1
241 dh_installchangelogs -a ChangeLog
242 # dh_strip -a
243 dh_compress -a
244 dh_fixperms -a
245 cd debian && find -name \*.la -exec chmod a-X {} \;
246 dh_installdeb -a
247 dh_makeshlibs -p$(LIBWRASTER) -V '$(LIBWRASTER) $(libwraster_deps)'
248 dh_shlibdeps -u-L$(LIBWRASTER_TMP)/DEBIAN/shlibs
249 dh_gencontrol -a -u-isp
250 dh_md5sums -a
251 find debian -type d -empty -print0 | xargs -0r rm -rf
252 $(RMDIR) $(DEBTMPDIR)/$(INCLUDEDIR)
253 dh_builddeb -a
255 binary: binary-indep binary-arch
257 install-wmaker-stamp: DH_OPTIONS=-pwmaker
258 install-wmaker-stamp: build-wmaker-stamp
259 dh_testdir
260 dh_installdirs
261 $(MAKE) -C $(WMAKER_BD) install DESTDIR=$(DEBTMPDIR)/
262 # Ugly hack, FIXME
263 mv $(DEBTMPDIR)/etc/WindowMaker/* $(DEBTMPDIR)/$(DEFAULTSDIR)/
265 # Now begin fixing stuff
267 # First, provide a wrapper to compensate for Window Maker's funny first
268 # start up requierements
269 mv $(DEBTMPDIR)/$(BINDIR)/wmaker $(DEBTMPDIR)/$(PKGLIBDIR)/WindowMaker
270 dh_link $(PKGLIBDIR)/WindowMaker $(BINDIR)/WindowMaker
271 $(install_prog) debian/wmaker.sh $(DEBTMPDIR)/$(BINDIR)/wmaker
273 -mv $(DEBTMPDIR)/$(BINDIR)/convertfonts $(DEBTMPDIR)/$(PKGLIBDIR)/
275 # place wm-oldmenu2new under a more appropiate directory
276 -mv $(DEBTMPDIR)/$(BINDIR)/wm-oldmenu2new $(DEBTMPDIR)/$(WMDOCDIR)
278 # put a symlink in place because there's some hardcoded value that says
279 # Defaults is under /usr/share/WindowMaker.
280 ln -s $(DEFAULTSDIR) $(DEBTMPDIR)/$(WMSHAREDIR)/Defaults
281 # the next is stricly not necessary, because there's a symlink in place,
282 # but I don't want to abuse it. Some dumb program uses that path and is a
283 # PITA to modify it)
284 perl -pi -e 's:/$(WPREFSAPPDIR)/WPrefs:/$(BINDIR)/WPrefs:' \
285 $(DEBTMPDIR)/$(DEFAULTSDIR)/WMState
287 # Ditch this!
288 $(RM) $(DEBTMPDIR)/$(BINDIR)/wmaker.inst
289 $(RM) $(DEBTMPDIR)/$(BINDIR)/wmsetup
290 # this copyright is located in /$(DOCDIR)/wmaker
291 $(RM) $(DEBTMPDIR)/$(WMCONFDIR)/Copyright
293 # Fix permissions
294 chmod +x $(DEBTMPDIR)/usr/share/WindowMaker/autostart.sh
295 chmod +x $(DEBTMPDIR)/usr/share/WindowMaker/exitscript.sh
297 # Install our transition script
298 $(install_prog) debian/upgrade-windowmaker-defaults \
299 $(DEBTMPDIR)/usr/sbin/upgrade-windowmaker-defaults
301 # This file qualifies as "unpatchable"
302 cp debian/WMWindowAttributes $(DEBTMPDIR)/$(DEFAULTSDIR)/
303 # Need this file for start up
304 echo '"menu.hook"' > $(DEBTMPDIR)/$(DEFAULTSDIR)/WMRootMenu
306 # the plethora of readmes
307 -cp $(TOPSRCDIR)/po/README \
308 $(DEBTMPDIR)/$(WMDOCDIR)/README.po
309 -cp $(TOPSRCDIR)/README.definable-cursor \
310 $(DEBTMPDIR)/$(WMDOCDIR)/README.definable-cursor
311 -cp $(WPREFSSRCDIR)/README \
312 $(DEBTMPDIR)/$(WMDOCDIR)/README.WPrefs
313 -cp $(WPREFSSRCDIR)/po/README \
314 $(DEBTMPDIR)/$(WMDOCDIR)/README.WPrefs.po
316 # Copy in the Debian theme
317 cp debian/Debian.theme $(DEBTMPDIR)/$(WMSHAREDIR)/Themes/Debian
318 uudecode -o $(DEBTMPDIR)/$(WMSHAREDIR)/Backgrounds/debian.tiff \
319 debian/debian.tiff.uu
320 # This has the new default Debian theme settings.
321 cp debian/WindowMaker.default $(DEBTMPDIR)/$(DEFAULTSDIR)/WindowMaker
323 # Overrides lintian warnings
324 dh_installdirs usr/share/lintian/overrides
325 cp debian/wmaker.overrides debian/wmaker/usr/share/lintian/overrides/wmaker
327 # WPrefs
328 # fix the location of WPrefs
329 # mv $(DEBTMPDIR)/$(WPREFSAPPDIR)/WPrefs $(DEBTMPDIR)/$(BINDIR)
330 # dh_link $(BINDIR)/WPrefs $(WPREFSAPPDIR)/WPrefs
331 dh_link $(WPREFSAPPDIR)/WPrefs $(BINDIR)/WPrefs
332 # libwraster is compiled with tiff support, we don't need the xpm version
333 $(RM) -r $(DEBTMPDIR)/$(WPREFSAPPDIR)/xpm
334 $(RM) $(patsubst %.tiff,%.xpm,$(wildcard $(DEBTMPDIR)/$(WMSHAREDIR)/Icons/*.tiff))
336 # Fix the get-*-flags scripts
337 perl -pi -e '/^WCFLAGS/ && s:=.*:="-I/usr/X11R6/include":; /^WLFLAGS/ && s:=.*:="-L/usr/X11R6/lib":;' `find $(DEBTMPDIR) -name get-*-flags`
338 perl -pi -e '/^WLIBS/ && s:=.*:="-lwraster":' `find $(DEBTMPDIR) -name get-wraster-flags`
339 perl -pi -e '/^WLIBS/ && s:=.*:="-lWINGs -lwraster -lXft":' `find $(DEBTMPDIR) -name get-wings-flags`
340 perl -pi -e '/^WLIBS/ && s:=.*:="-lWUtil -lX11":' `find $(DEBTMPDIR) -name get-wutil-flags`
342 ifeq (skip,)
343 if [ -d $(DEBTMPDIR)/usr/include/WINGs ] ; then \
344 mv $(DEBTMPDIR)/usr/include/WINGs/* \
345 $(DEBTMPDIR)/usr/include ; \
346 rmdir $(DEBTMPDIR)/usr/include/WINGs ; \
348 endif
350 debian/$(LIBWRASTER)-dev.files: build
351 ( find $(DEBTMPDIR)/$(INCLUDEDIR) $(DEBTMPDIR)/$(LIBDIR) \
352 -name '*wraster*.h' \
353 -o -name '*wraster*.a' \
354 -o -name '*wraster*.la' \
355 -o -name '*wraster*.so' ; \
356 cd $(DEBTMPDIR) && \
357 find usr -name get-wraster-flags \
358 ) | sed -e 's:$(DEBTMPDIR)/*::'> $@
360 debian/$(LIBWRASTER).files: build
361 ( find $(DEBTMPDIR)/$(INCLUDEDIR) $(DEBTMPDIR)/$(LIBDIR) \
362 -name '*wraster*.so.*' \
363 ) | sed -e 's:$(DEBTMPDIR)/*::'> $@
365 debian/libwings-dev.files: build
366 ( find $(DEBTMPDIR)/$(INCLUDEDIR) $(DEBTMPDIR)/$(LIBDIR) \
367 -name '*WINGs*' \
368 -o -name '*WUtil*' | grep -v '\.so\.[0-9]' ; \
369 cd $(DEBTMPDIR) && \
370 find usr -name get-wutil-flags -o -name get-wings-flags \
371 ) | sed -e 's:$(DEBTMPDIR)/*::'> $@
373 debian/shlibs.local:
374 echo 'libwraster $(patsubst libwraster%,%, $(LIBWRASTER)) $(LIBWRASTER) $(libwraster_deps)' > $@
376 configure: configure.ac
377 $(TOPSRCDIR)/autogen.sh
379 .PHONY: binary binary-arch binary-indep binary-custom clean build unpatch-wmaker