Improve dockapp recognition
[wmaker-crm.git] / debian / rules
blobb59ad6d7015bd7daf5a2ef61d98beb9d58fb7a3d
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))
39 XLOCALE := --disable-locale
40 MODELOCK := --enable-modelock
42 XINERAMA := --enable-xinerama
44 # USERMENU := --enable-usermenu
46 # SHAPE_EXT := --disable-shape
47 # USE_SHM := --disable-shm
49 # USE_XPM := --disable-xpm
50 # USE_PNG := --disable-png
51 # USE_JPEG := --disable-jpeg
52 # USE_GIF := --disable-gif
53 # USE_TIFF := --disable-tiff
55 WMAKER_OPTIONS := $(XLOCALE) $(MODELOCK) $(XINERAMA) \
56 $(USERMENU) $(SHAPE_EXT) $(USE_SHM) \
57 $(USE_XPM) $(USE_PNG) $(USE_JPEG) $(USE_GIF) $(USE_TIFF) \
58 $(HOSTSPEC)
60 TOPSRCDIR := $(shell pwd)
61 DEBTMPDIR := $(TOPSRCDIR)/debian/wmaker
63 WMAKER := wmaker
64 WMAKER_BD := $(TOPSRCDIR)/$(WMAKER)
65 WMAKER_TMP := $(DEBTMPDIR)
67 # Be careful with the leading / because some of these values are going
68 # to be hardcoded into the executables
70 BASEDIR := /usr
71 CONFDIR := /etc
72 BINDIR := $(BASEDIR)/bin
73 INCLUDEDIR := $(BASEDIR)/include
74 SHAREDIR := $(BASEDIR)/share
75 DOCDIR := $(SHAREDIR)/doc
76 MANDIR := $(SHAREDIR)/man
77 MAN1DIR := $(MANDIR)/man1
78 MAN8DIR := $(MANDIR)/man8
79 LIBDIR := $(BASEDIR)/lib
80 PKGLIBDIR := $(BASEDIR)/lib/WindowMaker
81 NLSDIR := $(SHAREDIR)/locale
82 WMCONFDIR := $(CONFDIR)/X11/WindowMaker
83 WMSHAREDIR := $(SHAREDIR)/WindowMaker
84 WMDOCDIR := $(DOCDIR)/wmaker
85 GNUSTEPDIR := $(LIBDIR)/GNUstep/System
86 GNUSTEPCONFDIR := $(CONFDIR)/GNUstep
87 DEFAULTSDIR := $(GNUSTEPCONFDIR)/Defaults
88 PIXMAPDIR := $(INCLUDEDIR)/X11/pixmaps
89 GNUSTEPAPPS := $(GNUSTEPDIR)/Applications
90 WPREFSAPPDIR := $(GNUSTEPAPPS)/WPrefs.app
92 WPREFSSRCDIR := $(TOPSRCDIR)/WPrefs.app
93 WRASTERSRCDIR := $(TOPSRCDIR)/wrlib
94 WINGSSRCDIR := $(TOPSRCDIR)/WINGs
96 LIBWRASTER := libwraster3
97 LIBWRASTER_TMP := $(DEBTMPDIR)/../$(LIBWRASTER)
98 LIBWINGS := libwings-dev
99 LIBWINGS_TMP := $(DEBTMPDIR)/../$(LIBWINGS)
101 RM := rm -f
102 RMDIR := rmdir --ignore-fail-on-non-empty
104 COMMON_OPTIONS := --prefix=$(BASEDIR) \
105 --mandir=$(MANDIR) \
106 --includedir=$(INCLUDEDIR) \
107 --sysconfdir=$(CONFDIR) \
108 --datadir=$(SHAREDIR) \
109 --with-nlsdir=$(NLSDIR) \
110 --with-pixmapdir=$(PIXMAPDIR) \
111 --with-gnustepdir=$(GNUSTEPDIR) \
112 --with-xft
114 install_file := install -p -o root -g root -m 0644
115 install_prog := install -p -o root -g root -m 0755
116 install_dir := install -p -d -o root -g root -m 0755
118 build: build-stamp
119 build-stamp: build-wmaker-stamp
120 touch $@
122 build-wmaker-stamp: config-wmaker-stamp
123 $(RM) $(patsubst %.in,%,$(shell find WindowMaker -name \*.in ! -name Makefile.in))
124 test -x libtool || ln -sf $(WMAKER_BD)/libtool .
125 $(MAKE) -C $(WMAKER_BD)
126 touch $@
128 config-wmaker-stamp: configure
129 dh_testdir
130 test -x config.guess || chmod +x config.guess
131 test -x config.sub || chmod +x config.sub
132 find -name \*.h.in | sed -e 's/\.in$$//' | xargs -r rm -f
133 mkdir -p $(WMAKER_BD)
134 cd $(WMAKER_BD) && \
135 LINGUAS="$(LINGUAS)" $(TOPSRCDIR)/configure $(COMMON_OPTIONS) \
136 $(WMAKER_OPTIONS) CFLAGS="$(CFLAGS)"
137 touch $@
139 clean:
140 dh_testdir
141 dh_testroot
142 $(RM) -r $(WMAKER_BD)
143 $(RM) *-stamp
144 dh_clean libtool
146 binary-indep: build
147 # dh_testdir -i
148 # dh_testroot
149 # dh_prep -i
151 binary-arch: build
152 dh_testdir -a
153 dh_testroot
154 dh_prep -a
155 dh_installdirs -a
156 debian/rules install-wmaker-stamp
157 dh_movefiles -a --sourcedir=debian/wmaker
158 # Remove cruft
159 $(RM) $(DEBTMPDIR)/usr/bin/wkdemenu.pl
160 # deal with menus
161 dh_installmenu -a --noscripts
162 $(install_prog) debian/appearance.menu-method \
163 $(DEBTMPDIR)/etc/menu-methods/wmappearance
164 $(install_file) WindowMaker/appearance.menu \
165 $(DEBTMPDIR)/$(WMCONFDIR)/
166 $(install_file) WindowMaker/background.menu \
167 $(DEBTMPDIR)/$(WMCONFDIR)/
168 $(install_file) WindowMaker/wmmacros \
169 $(DEBTMPDIR)/$(WMCONFDIR)/
170 touch $(DEBTMPDIR)/$(WMCONFDIR)/menu.prehook
171 touch $(DEBTMPDIR)/$(WMCONFDIR)/menu.posthook
172 $(install_file) debian/wmaker.desktop $(DEBTMPDIR)/usr/share/xsessions
173 dh_installdocs -a
174 $(install_file) $(WINGSSRCDIR)/README \
175 $(LIBWINGS_TMP)/$(DOCDIR)/$(LIBWINGS)/README.WINGs
176 $(install_file) $(WRASTERSRCDIR)/README \
177 $(LIBWRASTER_TMP)/$(DOCDIR)/$(LIBWRASTER)/README.wrlib
178 $(RM) $(DEBTMPDIR)/$(MAN1DIR)/convertstyle*
179 dh_installman -a
180 dh_installchangelogs -a ChangeLog
181 dh_link -a
182 dh_strip -a --dbg-package=wmaker-dbg
183 dh_lintian
184 dh_compress -a
185 dh_fixperms -a
186 cd debian && find -name \*.la -exec chmod a-X {} \;
187 #dh_makeshlibs -p$(LIBWRASTER) -V '$(LIBWRASTER) $(libwraster_deps)'
188 dh_makeshlibs -a
189 dh_installdeb -a
190 dh_shlibdeps -a
191 dh_gencontrol -a
192 dh_md5sums -a
193 find debian -type d -empty -print0 | xargs -0r rm -rf
194 $(RMDIR) $(DEBTMPDIR)/$(INCLUDEDIR)
195 dh_builddeb -a
197 binary: binary-indep binary-arch
199 install-wmaker-stamp: DH_OPTIONS=-pwmaker
200 install-wmaker-stamp: build-wmaker-stamp
201 dh_testdir
202 dh_installdirs
203 $(MAKE) -C $(WMAKER_BD) install DESTDIR=$(DEBTMPDIR)/
204 # Ugly hack, FIXME
205 mv $(DEBTMPDIR)/etc/WindowMaker/* $(DEBTMPDIR)/$(DEFAULTSDIR)/
207 # Now begin fixing stuff
209 # First, provide a wrapper to compensate for Window Maker's funny first
210 # start up requierements
211 mv $(DEBTMPDIR)/$(BINDIR)/wmaker $(DEBTMPDIR)/$(PKGLIBDIR)/WindowMaker
212 $(install_prog) debian/wmaker.sh $(DEBTMPDIR)/$(BINDIR)/wmaker
214 -mv $(DEBTMPDIR)/$(BINDIR)/convertfonts $(DEBTMPDIR)/$(PKGLIBDIR)/
216 # place wm-oldmenu2new under a more appropiate directory
217 -mv $(DEBTMPDIR)/$(BINDIR)/wm-oldmenu2new $(DEBTMPDIR)/$(WMDOCDIR)
219 # the next is stricly not necessary, because there's a symlink in place,
220 # but I don't want to abuse it. Some dumb program uses that path and is a
221 # PITA to modify it)
222 perl -pi -e 's:/$(WPREFSAPPDIR)/WPrefs:/$(BINDIR)/WPrefs:' \
223 $(DEBTMPDIR)/$(DEFAULTSDIR)/WMState
225 # Ditch this!
226 $(RM) $(DEBTMPDIR)/$(BINDIR)/wmaker.inst
227 $(RM) $(DEBTMPDIR)/$(BINDIR)/wmsetup
228 # this copyright is located in /$(DOCDIR)/wmaker
229 $(RM) $(DEBTMPDIR)/$(WMCONFDIR)/Copyright
231 # Fix permissions
232 chmod +x $(DEBTMPDIR)/usr/share/WindowMaker/autostart.sh
233 chmod +x $(DEBTMPDIR)/usr/share/WindowMaker/exitscript.sh
235 # Install our transition script
236 $(install_prog) debian/upgrade-windowmaker-defaults \
237 $(DEBTMPDIR)/usr/sbin/upgrade-windowmaker-defaults
239 # This file qualifies as "unpatchable"
240 cp debian/WMWindowAttributes $(DEBTMPDIR)/$(DEFAULTSDIR)/
241 # Need this file for start up
242 echo '"menu.hook"' > $(DEBTMPDIR)/$(DEFAULTSDIR)/WMRootMenu
244 # the plethora of readmes
245 -cp $(TOPSRCDIR)/po/README \
246 $(DEBTMPDIR)/$(WMDOCDIR)/README.po
247 -cp $(TOPSRCDIR)/README.definable-cursor \
248 $(DEBTMPDIR)/$(WMDOCDIR)/README.definable-cursor
249 -cp $(WPREFSSRCDIR)/README \
250 $(DEBTMPDIR)/$(WMDOCDIR)/README.WPrefs
251 -cp $(WPREFSSRCDIR)/po/README \
252 $(DEBTMPDIR)/$(WMDOCDIR)/README.WPrefs.po
254 # Copy in the Debian theme
255 cp debian/Debian.theme $(DEBTMPDIR)/$(WMSHAREDIR)/Themes/Debian
256 uudecode -o $(DEBTMPDIR)/$(WMSHAREDIR)/Backgrounds/debian.tiff \
257 debian/debian.tiff.uu
258 # This has the new default Debian theme settings.
259 cp debian/WindowMaker.default $(DEBTMPDIR)/$(DEFAULTSDIR)/WindowMaker
261 # libwraster is compiled with tiff support, we don't need the xpm version
262 $(RM) -r $(DEBTMPDIR)/$(WPREFSAPPDIR)/xpm
263 $(RM) $(patsubst %.tiff,%.xpm,$(wildcard $(DEBTMPDIR)/$(WMSHAREDIR)/Icons/*.tiff))
265 # Fix the get-*-flags scripts
266 perl -pi -e '/^WCFLAGS/ && s:=.*:="-I/usr/X11R6/include":; /^WLFLAGS/ && s:=.*:="-L/usr/X11R6/lib":;' `find $(DEBTMPDIR) -name get-*-flags`
267 perl -pi -e '/^WLIBS/ && s:=.*:="-lwraster":' `find $(DEBTMPDIR) -name get-wraster-flags`
268 perl -pi -e '/^WLIBS/ && s:=.*:="-lWINGs -lwraster -lXft":' `find $(DEBTMPDIR) -name get-wings-flags`
269 perl -pi -e '/^WLIBS/ && s:=.*:="-lWUtil -lX11":' `find $(DEBTMPDIR) -name get-wutil-flags`
271 configure: configure.ac
272 $(TOPSRCDIR)/autogen.sh
274 .PHONY: binary binary-arch binary-indep binary-custom clean build