Sync with OBS version
[profile/ivi/xorg-x11-server-misc.git] / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3 # Sample debian/rules that uses debhelper.
4 # This file was originally written by Joey Hess and Craig Small.
5 # As a special exception, when this file is copied by dh-make into a
6 # dh-make output file, you may use that output file without restriction.
7 # This special exception was added by Craig Small in version 0.37 of dh-make.
8
9 # Uncomment this to turn on verbose mode.
10 #export DH_VERBOSE=1
11
12 # These are used for cross-compiling and for saving the configure script
13 # from having to guess our platform (since we know it already)
14 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
15 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
16
17 CFLAGS ?= -Wall -g
18 LDFLAGS ?=
19 PREFIX ?= /usr
20 DATADIR ?= /opt
21 PREFIX_NS ?= usr
22 DATADIR_NS ?= opt
23 ARCH ?= $(DEB_HOST_ARCH_CPU)
24 ARCH_COMMON ?= $(ARCH)-common
25 CONF_FLAGS ?=  --with-arch=$(ARCH) --with-conf-prefix=$(DATADIR)
26
27 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
28         CFLAGS += -O0
29 else
30         CFLAGS += -O2
31 endif
32
33 configure:
34         #autoreconf -i -v -f
35         ./autogen.sh
36
37 config.status: configure
38         dh_testdir
39         # Add here commands to configure the package.
40
41         for f in `find $(CURDIR)/$(ARCH_COMMON)/ -name "*.in"`; do \
42                 cat $$f > $${f%.in}; \
43                 sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
44                 sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
45                 chmod a+x $${f%.in}; \
46         done
47
48         ./configure --prefix=$(PREFIX) $(CONF_FLAGS) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
49
50 build-emulfb: build-stamp
51         rm -rf $(CURDIR)/debian/tmp/opt/etc/X11/xorg.conf.d*
52
53 build-stamp: config.status
54         dh_testdir
55         # Add here commands to compile the package.
56         $(MAKE)
57         #docbook-to-man debian/x11proto-core.sgml > x11proto-core.1
58
59         for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
60                 cat $$f > $${f%.in}; \
61                 sed -i -e "s#@PREFIX@#$(PREFIX_NS)#g" $${f%.in}; \
62                 sed -i -e "s#@DATADIR@#$(DATADIR_NS)#g" $${f%.in}; \
63         done
64
65         touch $@
66
67 clean:
68         dh_testdir
69         dh_testroot
70         rm -f build-stamp
71
72         # Add here commands to clean up after the build process.
73         -$(MAKE) distclean
74 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
75         cp -f /usr/share/misc/config.sub config.sub
76 endif
77 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
78         cp -f /usr/share/misc/config.guess config.guess
79 endif
80         rm -f Makefile.in aclocal.m4 config.guess config.sub configure install-sh missing
81
82         for f in `find $(CURDIR)/$(ARCH_COMMON)/ -name "*.in"`; do \
83                 rm -f $${f%.in}; \
84         done
85
86         for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
87                 rm -f $${f%.in}; \
88         done
89
90         dh_clean
91
92 install-common:
93         dh_testdir
94         dh_testroot
95         dh_clean -k
96         dh_installdirs
97
98         # Add here commands to install the package into debian/tmp.
99         $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
100         mkdir $(CURDIR)/debian/tmp/etc/rc.d/init.d/ -p
101         mkdir $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/ -p
102         mkdir $(CURDIR)/debian/tmp/etc/rc.d/rc4.d/ -p
103         mkdir $(CURDIR)/debian/tmp/etc/profile.d/ -p
104         mkdir $(CURDIR)/debian/tmp/$(PREFIX)/etc/X11/ -p
105         cp -af $(CURDIR)/$(ARCH_COMMON)/xserver $(CURDIR)/debian/tmp/etc/rc.d/init.d/
106         cp -af $(CURDIR)/$(ARCH_COMMON)/xresources $(CURDIR)/debian/tmp/etc/rc.d/init.d/
107         cp -af $(CURDIR)/$(ARCH_COMMON)/xinitrc $(CURDIR)/debian/tmp/usr/etc/X11/
108         ln -s /etc/rc.d/init.d/xserver $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S20xserver
109         ln -s /etc/rc.d/init.d/xserver $(CURDIR)/debian/tmp/etc/rc.d/rc4.d/S20xserver
110         ln -s /etc/rc.d/init.d/xresources $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S80xresources
111         ln -s /etc/rc.d/init.d/xresources $(CURDIR)/debian/tmp/etc/rc.d/rc4.d/S80xresources
112         cp -af $(CURDIR)/$(ARCH_COMMON)/Xorg.sh $(CURDIR)/debian/tmp/etc/profile.d/
113         -cp -af $(CURDIR)/$(ARCH_COMMON)/Xmodmap $(CURDIR)/debian/tmp/opt/etc/X11/ > /dev/null
114
115 install-emulfb: build-emulfb install-common
116         -cp -af $(CURDIR)/$(ARCH)-emulfb/* $(CURDIR)/debian/tmp/opt/etc/X11/ > /dev/null
117
118 # Build architecture-independent files here.
119 binary-indep:
120 # We have nothing to do by default.
121
122 binary-emulfb: build-emulfb install-emulfb
123         dh_testdir
124         dh_testroot
125         dh_installchangelogs
126         dh_installdocs
127         dh_installexamples
128         dh_install --sourcedir=debian/tmp -pxserver-xorg-misc-emulfb
129         dh_installman
130         dh_link
131 #       dh_strip
132         dh_compress
133         dh_fixperms
134         -dh_installdeb -pxserver-xorg-misc-emulfb
135         dh_shlibdeps
136         -dh_gencontrol -pxserver-xorg-misc-emulfb
137         dh_md5sums
138         -dh_builddeb -pxserver-xorg-misc-emulfb
139
140 # Build architecture-dependent files here.
141 binary-arch: binary-emulfb
142
143 binary: binary-indep binary-arch
144 .PHONY: build clean binary-indep binary-arch binary install
145