chiark / gitweb /
Merge uaudio stragglers.
[disorder] / debian / rules
index 113f9893c05225c4bb934b8ae3628327e8ecf2ba..5c53f50bc27ae6044fcde3ffd47ffd3fc5d87e14 100755 (executable)
@@ -2,20 +2,18 @@
 #
 # Copyright (C) 2004-2008 Richard Kettlewell
 #
-# This program is free software; you can redistribute it and/or modify
+# This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
 #
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
 cgiexecdir=/usr/lib/cgi-bin
@@ -23,7 +21,7 @@ httpdir=/var/www
 browser=x-www-browser
 
 # Options to configure.  This can be overridden by the caller if necessary.
-CONFIGURE=--prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib --mandir=/usr/share/man --with-browser=$browser cgiexecdir="${cgiexecdir}" httpdir="${httpdir}"
+CONFIGURE=--prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib --mandir=/usr/share/man --with-browser=${browser} cgiexecdir="${cgiexecdir}" httpdir="${httpdir}"
 
 # Set DEB_BUILD_OPTIONS=noopt to produce a non-optimized build.
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
@@ -45,6 +43,12 @@ ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
 INSTALL_PROGRAM += -s
 endif
 
+# Set DEB_BUILD_OPTIONS=parallel=N to do make -jN
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+PARALLEL = -j$(NUMJOBS)
+endif
+
 export INSTALL_DATA
 export INSTALL_SCRIPT
 export INSTALL_PROGRAM
@@ -70,7 +74,7 @@ build:
          echo ./config.status;\
          ./config.status;\
        fi
-       $(MAKE) SENDMAIL=${SENDMAIL}
+       $(MAKE) SENDMAIL=${SENDMAIL} ${PARALLEL}
 
 pkg-disorder: build
        rm -rf debian/disorder
@@ -83,7 +87,13 @@ pkg-disorder: build
        $(INSTALL_DATA) debian/changelog \
                debian/disorder/usr/share/doc/disorder/changelog.Debian
        gzip -9 debian/disorder/usr/share/doc/disorder/changelog.Debian
-       @for f in preinst postinst prerm postrm conffiles templates config; do\
+       @for f in conffiles templates; do\
+         if test -e debian/$$f.disorder; then\
+           echo $(INSTALL_DATA) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
+           $(INSTALL_DATA) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
+         fi;\
+       done
+       @for f in preinst postinst prerm postrm config; do\
          if test -e debian/$$f.disorder; then\
            echo $(INSTALL_SCRIPT) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
            $(INSTALL_SCRIPT) debian/$$f.disorder debian/disorder/DEBIAN/$$f; \
@@ -130,12 +140,18 @@ pkg-disorder-server: build
        $(INSTALL_DATA) debian/changelog \
                debian/disorder-server/usr/share/doc/disorder-server/changelog.Debian
        gzip -9 debian/disorder-server/usr/share/doc/disorder-server/changelog.Debian
-       @for f in preinst postinst prerm postrm conffiles templates config; do\
+       @for f in preinst postinst prerm postrm config; do\
          if test -e debian/$$f.disorder-server; then\
            echo $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
            $(INSTALL_SCRIPT) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
          fi;\
        done
+       @for f in conffiles templates; do\
+         if test -e debian/$$f.disorder-server; then\
+           echo $(INSTALL_DATA) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
+           $(INSTALL_DATA) debian/$$f.disorder-server debian/disorder-server/DEBIAN/$$f; \
+         fi;\
+       done
        $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C images
        $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C server
        $(MAKE) DESTDIR=`pwd`/debian/disorder-server installdirs install -C templates
@@ -146,7 +162,20 @@ pkg-disorder-server: build
        rm -rf debian/disorder-server/usr/share/man/man1
        rm -rf debian/disorder-server/usr/share/man/man3
        rm -f debian/disorder-server/usr/share/man/man5/disorder_config.5
+       rm -f debian/disorder-server/usr/share/man/man5/disorder_preferences.5
        rm -f debian/disorder-server/usr/share/man/man5/disorder_protocol.5
+       find debian/disorder-server -name '*.la' -print0 | xargs -r0 rm -f
+       find debian/disorder-server -name '*.so.0' -print0 | xargs -r0 rm -f
+       @for f in debian/disorder-server/usr/lib/disorder/*.so.0.0.0; do \
+         echo mv $$f $${f/.0.0.0};\
+         mv $$f $${f/.0.0.0};\
+       done
+       @for f in debian/disorder-server/usr/lib/ao/plugins*/*.so.0.0.0; do \
+         echo mv $$f $${f/.0.0.0};\
+         mv $$f $${f/.0.0.0};\
+       done
+       find debian/disorder-server -name '*.so' -print0 | xargs -r0 strip --strip-unneeded
+       find debian/disorder-server -name '*.so' -print0 | xargs -r0 chmod -x
        $(MKDIR) debian/disorder-server/etc/disorder
        $(MKDIR) debian/disorder-server/etc/init.d
        $(MKDIR) debian/disorder-server${cgiexecdir}
@@ -161,10 +190,11 @@ pkg-disorder-server: build
                debian/disorder-server/etc/disorder/options.user
        $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) cgi/disorder \
                $(shell pwd)/debian/disorder-server${cgiexecdir}/disorder
+       gzip -9f debian/disorder-server/usr/share/man/man*/*
        dpkg-shlibdeps -Tdebian/substvars.disorder-server \
                debian/disorder-server${cgiexecdir}/disorder \
                debian/disorder-server/usr/sbin/* \
-               debian/disorder-server/usr/lib/disorder/*.so*
+               debian/disorder-server/usr/lib/disorder/*.so
        rm -rf debian/disorder-server/usr/share/doc/disorder-server
        ln -s disorder debian/disorder-server/usr/share/doc/disorder-server
        dpkg-gencontrol -isp -pdisorder-server -Pdebian/disorder-server -Tdebian/substvars.disorder-server
@@ -233,6 +263,7 @@ pkg-disobedience: build
                        debian/disobedience/usr/share/pixmaps
        $(INSTALL_DATA) debian/usr.share.menu.disobedience \
                debian/disobedience/usr/share/menu/disobedience
+       gzip -9f debian/disobedience/usr/share/man/man*/*
        dpkg-shlibdeps -Tdebian/substvars.disobedience \
                debian/disobedience/usr/bin/*
        rm -rf debian/disobedience/usr/share/doc/disobedience
@@ -265,7 +296,7 @@ binary-arch: pkg-disorder pkg-disorder-server pkg-disorder-playrtp \
 binary-indep: 
 
 clean:
-       -$(MAKE) distclean
+       test -f Makefile && $(MAKE) distclean
        rm -f config.cache
        rm -f debian/files
        rm -f debian/substvars.*