Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 24 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#!/usr/bin/make -f
# Sample debian/rules that uses debhelper. 
# GNU copyright 1997 by Joey Hess.
#
# This version is for a hypothetical package that builds an
# architecture-dependant package, as well as an architecture-independent
# package.
#
# $Id: rules,v 1.64 2006/08/05 15:49:18 grendel Exp $
#

# Uncomment this to turn on verbose mode. 
#export DH_VERBOSE=1
include /usr/share/dpatch/dpatch.make

ifdef CCVER
CC=gcc-$(CCVER)
else
CC=gcc
endif

ifeq (,$(DEB_BUILD_ARCH))
DEB_BUILD_ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
endif

CFLAGS_EXTRA = -g
CPPFLAGS_EXTRA = -DDEBIAN

ifdef SSP
SSP_FLAGS=-fstack-protector
endif

CFARGSEXTRA = --with-cdebug

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFARGSEXTRA += --without-copt
else
CFARGSEXTRA += --with-copt
endif

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFARGSEXTRA += --with-rtldebug
else
CFARGSEXTRA += --without-rtldebug
endif

CFLAGS_EXTRA += $(SSP_FLAGS)
# Temporary workaround for hppa linker issues
ifeq ($(DEB_BUILD_ARCH),hppa)
CFLAGS_EXTRA += -ffunction-sections
endif

ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
        INSTALL_PROGRAM += -s
endif

EXTRA_ARGS=--with-security

DO_MACHINE_CODE=no
ifeq ($(DEB_BUILD_ARCH),i386)
DO_MACHINE_CODE=yes
endif
ifeq ($(DEB_BUILD_ARCH),powerpc)
DO_MACHINE_CODE=yes
endif
ifeq ($(DEB_BUILD_ARCH),sparc)
DO_MACHINE_CODE=no
endif

ifeq ($(DO_MACHINE_CODE),yes)
MACHINE_OPTS=--with-machine-code
else
MACHINE_OPTS=--without-machine-code
endif

DEBVERSION:=$(shell dpkg-parsechangelog | sed -ne 's/Version: *\(.*\)-.*$$/\1/p')
MAJOR:=$(shell sed -ne 's/major://p' buildid.txt)
MINOR:=$(shell sed -ne 's/minor://p' buildid.txt)
BUILD:=$(shell sed -ne 's/build://p' buildid.txt)
PIKEV:=$(MAJOR).$(MINOR)
VERSION:=$(MAJOR).$(MINOR).$(BUILD)
PIKE:=pike$(PIKEV)

ifneq ($(VERSION),$(DEBVERSION))
$(error Version mismatch; buildid.txt: $(VERSION), debian/changelog: $(DEBVERSION))
endif

CFARGS=$(CFARGSEXTRA) \
       --with-cflags=\\'$(CFLAGS_EXTRA)\\' \
       --with-cppflags=\\'$(CPPFLAGS_EXTRA)\\' \
       --with-bignums \
       --with-gmp \
       --with-poll \
       --with-zlib \
       --with-freetype \
       --without-ttflib \
       --with-libnettle \
       --without-sybase \
       --without-java \
       --with-odbc \
       --with-sane \
       --with-postgres \
       --with-postgres-include-dir=`pg_config --includedir` \
       --with-libpq-dir=/usr/lib \
       --with-perl \
       --without-ffmpeg \
       --without-fftw \
       --without-libpdf \
       --without-libpanda \
       --without-GTK \
       --without-GTK2 \
       --without-bundles \
       $(MACHINE_OPTS) $(EXTRA_ARGS)

include_prefix=/usr/include/pike/$(VERSION)
lib_prefix=/usr/lib/pike/$(VERSION)

MODULE_PACKAGES=$(shell dh_listpackages -a -N $(PIKE)-core -N $(PIKE)-dev)
#{ADT,Array,Audio,Cache,Calendar,Calendar_I,COM,Colors,CommonLog,Crypto,Debug,Filesystem,Error,Float,Function,Geography,Getopt,Gettext,Gmp,Graphics,Gz,HTTPAccept,Int,Kerberos,Languages,Local,Locale,Mapping,Math,MIME,Mird,Multiset,Nettle,Parser,Pike,Pipe,Process,Program,Protocols,Regexp,Remote,SSL,Shuffler,Standards,Stdio,String,System,Thread,Tools,Unicode,Web,Yabu,Yp,_ADT,_Charset,_Roxen,___Gz,___MIME,___Math,___Mird,___Regexp,___Yp,____Charset,__builtin*,spider}.
#usr/lib/pike/*/modules/Sql.pmod/{module,Sql,rsql,sql_*}.*

excluded_modules:=Ssleay Mird Msql msql PDF Ffmpeg Oracle oracle sybase Gnome GTK GDK DVB Java TTF
# This is tricky. Note that it's only possible for an exclusion to match the last
# component specified in an .install file or on the command line, and below.
DH_EXCLUDE:=$(addprefix -X,$(excluded_modules))
DH_ALREADY=`for p in $(MODULE_PACKAGES); do \
              find debian/$$p/usr/lib/pike/*/* -type f -printf "-X%P "; done`

TMP=$(CURDIR)/debian/tmp

#export CFLAGS CC PIKE VERSION
export CC

build-arch: build-arch-stamp
build-arch-stamp: $(DPATCH_STAMPFN)
        dh_testdir

        # Add here command to compile/build the package.
        $(MAKE) compile CONFIGUREARGS="$(CFARGS)"
        touch build-arch-stamp

build-indep: build-indep-stamp
build-indep-stamp: $(DPATCH_STAMPFN)
        dh_testdir

        # Add here command to compile/build the arch indep package.
        $(MAKE) documentation CONFIGUREARGS="$(CFARGS)"
        touch build-indep-stamp

build: build-arch

clean: clean-patched unpatch
        dh_clean

clean-patched:
        dh_testdir
        dh_testroot
        rm -f build-stamp build-arch-stamp build-indep-stamp configure-stamp

        # Add here commands to clean up after the build process.
        $(MAKE) distclean
        rm -rf refdoc/modref refdoc/traditional_manual

install: DH_OPTIONS=
install: build-arch
        dh_testdir
        dh_testroot
        dh_clean -k

        $(MAKE) INSTALLARGS=--traditional \
                buildroot=$(TMP) \
                prefix=/usr \
                man_prefix=/usr/share/man \
                lib_prefix="$(lib_prefix)" \
                include_prefix="$(include_prefix)" \
                pike_name=/usr/bin/$(PIKE) \
                install_nodoc

#       Some cleaning
        find "$(TMP)$(lib_prefix)" -name '.autodoc' -type f -exec rm -f '{}' ';'

        install -d -m755 $(TMP)/usr/share/pixmaps
        install -m644 debian/pike.xpm $(TMP)/usr/share/pixmaps/$(PIKE).xpm
        mv $(TMP)/usr/bin/pike $(TMP)/usr/bin/$(PIKE)
        mv $(TMP)/usr/share/man/man1/pike.1 $(TMP)/usr/share/man/man1/$(PIKE).1

#       Simply strip exec permissions and shebangs from all pike scripts.
        find $(TMP)/usr -name *.p* -type f \
                -exec chmod a-x '{}' + \
                -exec sed -ri -e '1!b;/^#!/d' '{}' +

#       Don't install our own specs file - the ordinary one is not that bad really
#       sed -e 's/@PIKEVERSION@/$(VERSION)/g' \
            -e 's;@CONFIGURE_ARGS@;$(CFARGS);g' \
            debian/specs.in > $(TMP)$(include_prefix)/specs

#       Install pike-config
        sed -e "s#@CFLAGS@#-I$(include_prefix)#;s/@LDFLAGS@//" \
            -e "s/@MAJOR@/$(MAJOR)/;s/@MINOR@/$(MINOR)/;s/@BUILD@/$(BUILD)/" \
            debian/pike-config.in > $(TMP)/usr/bin/$(PIKE)-config

#       # pike -x module fix
        sed -i -e 's;\$$(MODULE_BASE)/dynamic_module_makefile;\$$(PIKE_SRC_DIR)/dynamic_module_makefile;g' \
                $(TMP)$(include_prefix)/dynamic_module_makefile

# Build architecture-independent files here.
# Pass -i to all debhelper commands in this target to reduce clutter.
binary-indep: build-indep
        dh_testdir -i
        dh_testroot -i
        # install the docs
        dh_install -p$(PIKE)-manual refdoc/traditional_manual/* usr/share/doc/$(PIKE)-doc/html/manual
        dh_install -p$(PIKE)-reference refdoc/modref/* usr/share/doc/$(PIKE)-doc/html/reference
        dh_install -i -N$(PIKE)-manual -N$(PIKE)-reference --sourcedir=$(TMP)
        dh_installdocs -i
        dh_installchangelogs -i -k CHANGES
        dh_link -i
        dh_compress -i
        dh_fixperms -i
        dh_installdeb -i
        dh_gencontrol -i
        dh_md5sums -i
        dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build-arch install
        dh_testdir -a
        dh_testroot -a
#       dh_installdebconf -a
        dh_install -a -N$(PIKE)-core --sourcedir=debian/tmp $(DH_EXCLUDE)
        dh_install -p$(PIKE)-core --sourcedir=debian/tmp $(DH_EXCLUDE) $(DH_ALREADY)
        for p in $(MODULE_PACKAGES) $(PIKE)-dev; do \
                dh_link -p$$p usr/share/doc/$(PIKE)-core usr/share/doc/$$p; \
        done
        dh_installdocs -a
        dh_installmenu -a
#       dh_installman -a
        dh_installchangelogs -a -k CHANGES
        dh_strip -a
        dh_compress -a
        dh_fixperms -a -X/run_autoconfig -X/precompile.sh -X/smartlink -X/fixdepends.sh -X/install_module -X/mktestsuite
        dh_installdeb -a
        dh_shlibdeps -a
        dh_gencontrol -a
        dh_md5sums -a
        dh_builddeb -a

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure