Fix possible missing NUL at end of string
[wmaker-crm.git] / debian / rules
blob054e6c702c98c3a1154edf3870fc62d5afc53818
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)
113 install_file := install -p -o root -g root -m 0644
114 install_prog := install -p -o root -g root -m 0755
115 install_dir := install -p -d -o root -g root -m 0755
117 build: build-stamp
118 build-stamp: build-wmaker-stamp
119 touch $@
121 build-wmaker-stamp: config-wmaker-stamp
122 $(RM) $(patsubst %.in,%,$(shell find WindowMaker -name \*.in ! -name Makefile.in))
123 test -x libtool || ln -sf $(WMAKER_BD)/libtool .
124 $(MAKE) -C $(WMAKER_BD)
125 touch $@
127 config-wmaker-stamp: configure
128 dh_testdir
129 test -x config.guess || chmod +x config.guess
130 test -x config.sub || chmod +x config.sub
131 find -name \*.h.in | sed -e 's/\.in$$//' | xargs -r rm -f
132 mkdir -p $(WMAKER_BD)
133 cd $(WMAKER_BD) && \
134 LINGUAS="$(LINGUAS)" $(TOPSRCDIR)/configure $(COMMON_OPTIONS) \
135 $(WMAKER_OPTIONS) CFLAGS="$(CFLAGS)"
136 touch $@
138 clean:
139 dh_testdir
140 dh_testroot
141 $(RM) -r $(WMAKER_BD)
142 $(RM) *-stamp
143 dh_clean libtool
145 binary-indep: build
146 # dh_testdir -i
147 # dh_testroot
148 # dh_prep -i
150 binary-arch: build
151 dh_testdir -a
152 dh_testroot
153 dh_prep -a
154 dh_installdirs -a
155 debian/rules install-wmaker-stamp
156 dh_movefiles -a --sourcedir=debian/wmaker
157 # Remove cruft
158 $(RM) $(DEBTMPDIR)/usr/bin/wkdemenu.pl
159 # deal with menus
160 dh_installmenu -a --noscripts
161 $(install_prog) debian/appearance.menu-method \
162 $(DEBTMPDIR)/etc/menu-methods/wmappearance
163 $(install_file) WindowMaker/appearance.menu \
164 $(DEBTMPDIR)/$(WMCONFDIR)/
165 $(install_file) WindowMaker/background.menu \
166 $(DEBTMPDIR)/$(WMCONFDIR)/
167 $(install_file) WindowMaker/wmmacros \
168 $(DEBTMPDIR)/$(WMCONFDIR)/
169 touch $(DEBTMPDIR)/$(WMCONFDIR)/menu.prehook
170 touch $(DEBTMPDIR)/$(WMCONFDIR)/menu.posthook
171 $(install_file) debian/wmaker.desktop $(DEBTMPDIR)/usr/share/xsessions
172 dh_installdocs -a
173 $(install_file) $(WINGSSRCDIR)/README \
174 $(LIBWINGS_TMP)/$(DOCDIR)/$(LIBWINGS)/README.WINGs
175 $(install_file) $(WRASTERSRCDIR)/README \
176 $(LIBWRASTER_TMP)/$(DOCDIR)/$(LIBWRASTER)/README.wrlib
177 $(RM) $(DEBTMPDIR)/$(MAN1DIR)/convertstyle*
178 dh_installman -a
179 dh_installchangelogs -a ChangeLog
180 dh_link -a
181 dh_strip -a --dbg-package=wmaker-dbg
182 dh_lintian
183 dh_compress -a
184 dh_fixperms -a
185 cd debian && find -name \*.la -exec chmod a-X {} \;
186 #dh_makeshlibs -p$(LIBWRASTER) -V '$(LIBWRASTER) $(libwraster_deps)'
187 dh_makeshlibs -a
188 dh_installdeb -a
189 dh_shlibdeps -a
190 dh_gencontrol -a
191 dh_md5sums -a
192 find debian -type d -empty -print0 | xargs -0r rm -rf
193 $(RMDIR) $(DEBTMPDIR)/$(INCLUDEDIR)
194 dh_builddeb -a
196 binary: binary-indep binary-arch
198 install-wmaker-stamp: DH_OPTIONS=-pwmaker
199 install-wmaker-stamp: build-wmaker-stamp
200 dh_testdir
201 dh_installdirs
202 $(MAKE) -C $(WMAKER_BD) install DESTDIR=$(DEBTMPDIR)/
203 # Ugly hack, FIXME
204 mv $(DEBTMPDIR)/etc/WindowMaker/* $(DEBTMPDIR)/$(DEFAULTSDIR)/
206 # Now begin fixing stuff
208 # First, provide a wrapper to compensate for Window Maker's funny first
209 # start up requierements
210 mv $(DEBTMPDIR)/$(BINDIR)/wmaker $(DEBTMPDIR)/$(PKGLIBDIR)/WindowMaker
211 $(install_prog) debian/wmaker.sh $(DEBTMPDIR)/$(BINDIR)/wmaker
213 -mv $(DEBTMPDIR)/$(BINDIR)/convertfonts $(DEBTMPDIR)/$(PKGLIBDIR)/
215 # place wm-oldmenu2new under a more appropiate directory
216 -mv $(DEBTMPDIR)/$(BINDIR)/wm-oldmenu2new $(DEBTMPDIR)/$(WMDOCDIR)
218 # the next is stricly not necessary, because there's a symlink in place,
219 # but I don't want to abuse it. Some dumb program uses that path and is a
220 # PITA to modify it)
221 perl -pi -e 's:/$(WPREFSAPPDIR)/WPrefs:/$(BINDIR)/WPrefs:' \
222 $(DEBTMPDIR)/$(DEFAULTSDIR)/WMState
224 # Ditch this!
225 $(RM) $(DEBTMPDIR)/$(BINDIR)/wmaker.inst
226 $(RM) $(DEBTMPDIR)/$(BINDIR)/wmsetup
227 # this copyright is located in /$(DOCDIR)/wmaker
228 $(RM) $(DEBTMPDIR)/$(WMCONFDIR)/Copyright
230 # Fix permissions
231 chmod +x $(DEBTMPDIR)/usr/share/WindowMaker/autostart.sh
232 chmod +x $(DEBTMPDIR)/usr/share/WindowMaker/exitscript.sh
234 # Install our transition script
235 $(install_prog) debian/upgrade-windowmaker-defaults \
236 $(DEBTMPDIR)/usr/sbin/upgrade-windowmaker-defaults
238 # This file qualifies as "unpatchable"
239 cp debian/WMWindowAttributes $(DEBTMPDIR)/$(DEFAULTSDIR)/
240 # Need this file for start up
241 echo '"menu.hook"' > $(DEBTMPDIR)/$(DEFAULTSDIR)/WMRootMenu
243 # the plethora of readmes
244 -cp $(TOPSRCDIR)/po/README \
245 $(DEBTMPDIR)/$(WMDOCDIR)/README.po
246 -cp $(TOPSRCDIR)/README.definable-cursor \
247 $(DEBTMPDIR)/$(WMDOCDIR)/README.definable-cursor
248 -cp $(WPREFSSRCDIR)/README \
249 $(DEBTMPDIR)/$(WMDOCDIR)/README.WPrefs
250 -cp $(WPREFSSRCDIR)/po/README \
251 $(DEBTMPDIR)/$(WMDOCDIR)/README.WPrefs.po
253 # Copy in the Debian theme
254 cp debian/Debian.theme $(DEBTMPDIR)/$(WMSHAREDIR)/Themes/Debian
255 uudecode -o $(DEBTMPDIR)/$(WMSHAREDIR)/Backgrounds/debian.tiff \
256 debian/debian.tiff.uu
257 # This has the new default Debian theme settings.
258 cp debian/WindowMaker.default $(DEBTMPDIR)/$(DEFAULTSDIR)/WindowMaker
260 # libwraster is compiled with tiff support, we don't need the xpm version
261 $(RM) -r $(DEBTMPDIR)/$(WPREFSAPPDIR)/xpm
262 $(RM) $(patsubst %.tiff,%.xpm,$(wildcard $(DEBTMPDIR)/$(WMSHAREDIR)/Icons/*.tiff))
264 # Fix the get-*-flags scripts
265 perl -pi -e '/^WCFLAGS/ && s:=.*:="-I/usr/X11R6/include":; /^WLFLAGS/ && s:=.*:="-L/usr/X11R6/lib":;' `find $(DEBTMPDIR) -name get-*-flags`
266 perl -pi -e '/^WLIBS/ && s:=.*:="-lwraster":' `find $(DEBTMPDIR) -name get-wraster-flags`
267 perl -pi -e '/^WLIBS/ && s:=.*:="-lWINGs -lwraster -lXft":' `find $(DEBTMPDIR) -name get-wings-flags`
268 perl -pi -e '/^WLIBS/ && s:=.*:="-lWUtil -lX11":' `find $(DEBTMPDIR) -name get-wutil-flags`
270 configure: configure.ac
271 $(TOPSRCDIR)/autogen.sh
273 .PHONY: binary binary-arch binary-indep binary-custom clean build