[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Separating packages.



(reposted because I think a virus-eater killed the attachment?) 

Jeroen van Wolffelaar <jeroen@wolffelaar.nl> writes:

> On Tue, Apr 06, 2004 at 08:18:55AM -0400, Erik Bourget wrote:
>> Fabian Fagerholm <fabbe@paniq.net> writes:
>> This is perhaps the most difficult thing to understand about Debian
>> packaging. It's implied in several places, and it's briefly spelt out in
>> some other places, but in general, you are referred to "examples" which
>> vary as much as the packages in the Debian archive.
>
> Maybe it's an idea to improve the available documents? (thinking NM
> guide)

This is an EXCELLENT idea, I was totally clueless until I found this list and
the policy/NMG were frustratingly almost helpful.

On a related note, here is the rules file that I made after cutting up
dh_make's "Multiple Binary" option.  I think that it's a lot clearer when
there is not necessarily arch and indep versions (my packages are a perl
program and a shell-script wrapper to run it via daemontools, so this didn't
really fit the mold).

Something like this should possibly be added to dh_make, as multiple binary !=
arch and indep always, especially with big python, perl, java, etc programs.

What you do is just specify the packages you are making in BUILD_PACKAGES,
INSTALL_PACKAGES, and BINARY_PACKAGES (I'm sure that make has loops but I
don't know how to do them, you could turn this into one variable pretty
easily) and it will Just Go, calling make install-$(PACKAGENAME) with the
appropriate DESTDIR for each package.

For reference, my packages were called "ossadmin" and "ossadmin-run", I left
these in the rules file.

IOW:  Here's another 'example'. 8D~

#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets  by Bill Allombert 2001
#
# Hacked up to use wildcarding instead of explicit arch/indep stuff by 
# Erik Bourget 2004
#
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

CFLAGS = -Wall -g

BUILD_PACKAGES   = build-ossadmin build-ossadmin-run
INSTALL_PACKAGES = install-ossadmin install-ossadmin-run
BINARY_PACKAGES  = binary-ossadmin binary-ossadmin-run

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

configure: configure-stamp
configure-stamp:
	dh_testdir
	touch configure-stamp

build: $(BUILD_PACKAGES)

build-%: build-%-stamp
	# nothing to be done

build-%-stamp: configure-stamp
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f *-stamp
	-$(MAKE) clean

	dh_clean 

install: $(INSTALL_PACKAGES)

install-%:
	dh_testdir
	dh_testroot
	dh_clean -k -p$*
	dh_installdirs -p$*

	$(MAKE) install-$* DESTDIR=$(CURDIR)/debian/$*
	dh_install -p$*

# Must not depend on anything. This is to be called by
# binary-arch/binary-indep
# in another 'make' thread.
binary-common:
	dh_testdir
	dh_testroot
	dh_installchangelogs 
	dh_installdocs
	dh_installexamples
#	dh_installmenu
#	dh_installdebconf	
#	dh_installlogrotate	
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
#	dh_installcron
#	dh_installinfo
	dh_installman
	dh_link
	dh_strip
	dh_compress 
	dh_fixperms
#	dh_perl
#	dh_python
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb
# Build architecture independant packages using the common target.

binary-%: build-% install-%
	$(MAKE) -f debian/rules DH_OPTIONS=-p$* binary-common

binary: $(BINARY_PACKAGES)

.PHONY: build clean binary install configure




Reply to: