[Pkg-java-kaffe] RFC: kaffe/debian/rules

Arnaud Vandyck avdyk@debian.org
Thu, 17 Jun 2004 16:50:27 +0200


--=-=-=

Hi,

I'd like to rationalize debian/rules because I made some changes but
it was not very clean!

Problems: 

o profiling and xprofiling are only available on x86;

o debug is only needed for kaffe-pthread-profiling (IMHO)

o it should be easy to build without sound support; libffi is not
  available on mipsel

o sound does not work for me on sparc and alpha.

I'd like to understand these lines (I'm not even a beginner in
Makefiles!):

$(STAMP_DIR)/build-pthreads-profile $(STAMP_DIR)/build-pthreads: $(STAMP_DIR)/build-jthreads
$(STAMP_DIR)/configure-pthreads-profile: CONFFLAGS += --with-staticvm --with-staticlib --disable-debug --with-rt-jar=$(CURDIR)/build/jthreads/libraries/javalib/rt.jar
$(STAMP_DIR)/configure-pthreads: CONFFLAGS += --disable-debug --with-rt-jar=$(CURDIR)/build/jthreads/libraries/javalib/rt.jar $(LIBFFIAVAILABLE) --with-jikes

And last, I'd like to split arch-dep and arch-indep build. The packages
has been split, many thanks it's a very good job; but as you can see in
debian/rules:

binary: binary-indep binary-arch
binary-indep: build install
binary-arch: build install

IMHO, binary-indep should depends on build-indep and install-indep and
binary-arch should depends on build-arch and install-arch.

For that purpose, we have to add kaffe-common in the build-dep field, so
we can add the --with-prebuilt-rt-jar=/usr/share/kaffe-common-lib/rt.jar
CONFFLAG and create different targets: -arch, -indep.

The bad news:

o alpha debian buildd is still down;

o I don't have access to an arm machine (but it may not be needed)

The good news:

o s390 built;

o m68k built;

o ia64 built;

o hppa built;

o I've been able to build on alpha (but without sound support);

o arm failure is because I think jikes is broken on arm... if we can
  split arch and indep build, rt.jar will not be build, so arm should be
  ok!

o I'm still building on sparc (but without sound support) and it seems
  to be good;

So!

I need your comments about my changed debian/rules and ways to improve
it. I'd like to thank you one more time for your work on splitting the
package and I'd like to go further in splitting arch and indep build.

Many thanks for your time and help,

-- 
Arnaud Vandyck


--=-=-=
Content-Disposition: attachment; filename=rules
Content-Description: debian/rules from latest not released yet kaffe debian package

#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

colon		:= :
comma		:= ,
empty		:=
space		:= $(empty) $(empty)

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

KAFFE_JIKES	:= 1
KAFFE_GCJ	:=
WITHOUT_SOUND :=
WITH_PROFILING :=
WITH_XPROFILING :=
WITHOUT_DEBUG := 1

CONFFLAGS	:= \
	--with-pic \
	--infodir='/usr/share/info' \
	--mandir='/usr/share/man' \
  --with-staticvm --with-staticlib \
  --host=$(DEB_HOST_GNU_TYPE) \
  --build=$(DEB_BUILD_GNU_TYPE) \
	--with-prebuilt-rt-jar=/usr/share/kaffe-common/lib/rt.jar

SYSTEMS		:= jthreads pthreads pthreads-profile
jthreads-PRIORITY		:= 0
pthreads-PRIORITY		:= 1000
pthreads-profile-PRIORITY	:= -1000

prerms		:= $(patsubst %,debian/kaffe-%.prerm,$(SYSTEMS))
postinsts	:= $(patsubst %,debian/kaffe-%.postinst,$(SYSTEMS))

ifneq ($(strip $(KAFFE_JIKES)),)
CONFFLAGS	+= --with-jikes
endif

ifneq ($(strip $(KAFFE_GCJ)),)
CONFFLAGS	+= --enable-gcj
else
CONFFLAGS	+= --disable-gcj
endif

# libffi is not available on mipsel
ifneq ($(shell dpkg --print-architecture),mipsel)
CONFFLAGS += --with-libffi
endif

ifneq ($(strip $(WITHOUT_SOUND)),)
CONFFLAGS += --disable-sound
endif

ifneq ($(strip $(WITH_PROFILING)),)
CONFFLAGS += --with-profiling 
endif

ifneq ($(strip $(WITH_XPROFILING)),)
CONFFLAGS += --enable-xprofiling
endif

ifneq ($(strip $(WITHOUT_DEBUG)),)
CONFFLAGS += --disable-debug
endif

# Include any additional architecture specific rules
ifneq ($(wildcard debian/rules.$(BUILDARCH)),)
	include debian/rules.$(BUILDARCH)
endif

CFLAGS = -Wall -g

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

#config.status: configure
#	dh_testdir
#	# Add here commands to configure the package.
#	./configure $(CONFFLAGS)

#
# DBS
#
export DH_COMPAT=3
RELEASE = 1.1.4.PRE1.1.5
TAR_DIR = kaffe-$(RELEASE)
# the dbs rules
include /usr/share/dbs/dbs-build.mk

# convenient way to set architecture specification strings
# the ifeq condition is here to allow them to be overridden
# from the command line
ifeq (,$(DEB_BUILD_GNU_TYPE))
	include /usr/share/dbs/dpkg-arch.mk
endif


$(STAMP_DIR)/build-pthreads-profile $(STAMP_DIR)/build-pthreads: $(STAMP_DIR)/build-jthreads
$(STAMP_DIR)/configure-pthreads-profile: CONFFLAGS += --with-staticvm --with-staticlib --disable-debug --with-rt-jar=$(CURDIR)/build/jthreads/libraries/javalib/rt.jar $(LIBFFIAVAILABLE) --with-jikes
# --with-profiling --enable-xprofiling 
# --disable-sound
$(STAMP_DIR)/configure-pthreads: CONFFLAGS += --disable-debug --with-rt-jar=$(CURDIR)/build/jthreads/libraries/javalib/rt.jar $(LIBFFIAVAILABLE) --with-jikes

configure: $(patsubst %,$(STAMP_DIR)/configure-%,$(SYSTEMS))
$(patsubst %,$(STAMP_DIR)/configure-%,$(SYSTEMS)): $(STAMP_DIR)/configure-%: $(patched)
	dh_testdir
# Add here commands to configure the package.
	mkdir -p build/$*
	cd build/$* && $(CURDIR)/$(BUILD_TREE)/configure $(CONFFLAGS) --with-threads=unix-$(word 1,$(subst -,$(space),$*)) --prefix=/usr/lib/kaffe/$* --sharedstatedir=/var/lib/kaffe/$*
	touch $@

build: $(patsubst %,$(STAMP_DIR)/build-%,$(SYSTEMS))
$(patsubst %,$(STAMP_DIR)/build-%,$(SYSTEMS)): $(STAMP_DIR)/build-%: $(STAMP_DIR)/configure-%
	dh_testdir

	$(MAKE) -C build/$*
	#/usr/bin/docbook-to-man debian/kaffe.sgml > kaffe.1
	mkdir -p $(@D)
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f $(postinsts) $(prerms)
	rm -rf build debian/install
#	rm -f build-stamp configure-stamp
# Add here commands to clean up after the build process.
	rm -rf $(STAMP_DIR) $(SOURCE_DIR)
	dh_clean

$(postinsts): debian/kaffe-%.postinst: debian/kaffe-SYSTEM.postinst.in
$(prerms): debian/kaffe-%.prerm: debian/kaffe-SYSTEM.prerm.in

$(postinsts) $(prerms):
	sed 's/@NAME@/$*/g;s/@PRIORITY@/$($*-PRIORITY)/g' < $< > $@.new
	mv $@.new $@

install: build $(postinsts) $(prerms)
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	rm -rf debian/install
	# Add here commands to install the package into debian/kaffe.
	$(MAKE) -C build/jthreads install DESTDIR=$(CURDIR)/debian/install
	$(MAKE) -C build/pthreads install DESTDIR=$(CURDIR)/debian/install
	$(MAKE) -C build/pthreads-profile install DESTDIR=$(CURDIR)/debian/install
	perl debian/file-actions.pl -v $(CURDIR)/debian/install
	# Install jikes-kaffe wrapper
	install -m 755 $(CURDIR)/debian/wrappers/jikes-kaffe $(CURDIR)/debian/jikes-kaffe/usr/bin/jikes-kaffe

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir -i
	dh_testroot -i
	dh_install -i --sourcedir=debian/install
	dh_installdocs -i
	mkdir -p debian/kaffe-doc/usr/share/doc/kaffe/FAQ
	chmod -x build-tree/kaffe-$(RELEASE)/kaffe/scripts/nm2as.awk
	cp build-tree/kaffe-$(RELEASE)/FAQ/FAQ.* debian/kaffe-doc/usr/share/doc/kaffe/FAQ
	dh_installchangelogs $(BUILD_TREE)/ChangeLog -i
#	dh_installinfo -i
	dh_installman -i
	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 install
	dh_testdir -s
	dh_testroot -s
	dh_install -s --sourcedir=debian/install
	dh_installchangelogs $(BUILD_TREE)/ChangeLog -s
	dh_installdocs -s
	dh_installexamples -s
#	dh_install
#	dh_installmenu
#	dh_installdebconf	
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
#	dh_installcron
#	dh_installinfo
	dh_installman -s
	dh_link -s
	dh_strip -s -N kaffe-pthreads-profile
	dh_compress -s
	dh_fixperms -s
#	dh_perl
#	dh_python
#	dh_makeshlibs
	dh_installdeb -s
	dh_shlibdeps -s
	dh_gencontrol -s
	dh_md5sums -s
	dh_builddeb -s

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

--=-=-=--