On Fri, Sep 16, 2011 at 12:17:40PM +0300, Riku Voipio wrote:
> > Here is a updated patch. Steves patch is not quite enough for multiarch
> > cross-compiling. For example when compiling from amd64 to armel, 
> > We need a /usr/bin/flex we can run, so it needs to amd64 binary, while we 
> > need
> > a libfl.a that is armel architecture. The only way to achieve this is to 
> > split
> > the package and move libfl to the multiarch library directory.

> The patch needed still a few patchs - like setting up the env variables
> explicitly in archvars, build-depend on new enough dpkg, install
> doc/$package symlink and fix the reference directory in the .so

> Attaching updated patch.

I've reviewed this patch and tweaked it a bit.  Notable changes:

 - flex and libfl-dev shouldn't have a circular dependency.  There will be
   screaming on debian-devel for this. ;)  Flex does need to depend on
   libfl-dev to maintain compatibility, but I think the other dependency is
   not needed.
 - no dependency on multiarch-support is required because there are no
   shared libs.
 - the libfl-dev package stanza seems to have accidentally been inserted in
   the middle of the flex-doc stanza; cleaned this up.
 - since libfl-dev doesn't depend on flex, it's improper to have libfl-dev's
   doc directory symlink to flex's.  So we reverse this symlink too.
 - and since libfl-dev is Multi-Arch: same, everything in this package needs
   to be compressed with gzip -n so that the output is idempotent between
   different builds.
 - the sed command for creating libfl.so uses sed -i by mistake; fixed up.
 - the headers should also be installed with libfl-dev rather than flex, for
   consistency.
 - replaces are needed from libfl-dev to the old flex.

Attached is an updated patch with these changes.  With this version of the
patch, I get a correct set of multiarch-friendly packages for flex.

Cheers,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
=== modified file 'debian/common/archvars.mk'
--- debian/common/archvars.mk	2006-10-23 23:50:43 +0000
+++ debian/common/archvars.mk	2011-11-07 01:40:55 +0000
@@ -80,6 +80,7 @@
 export DEB_HOST_GNU_CPU    := $(shell $(DPKG_ARCH) $(ha) -qDEB_HOST_GNU_CPU)
 export DEB_HOST_GNU_SYSTEM := $(shell $(DPKG_ARCH) $(ha) -qDEB_HOST_GNU_SYSTEM)
 export DEB_HOST_GNU_TYPE   := $(shell $(DPKG_ARCH) $(ha) -qDEB_HOST_GNU_TYPE)
+export DEB_HOST_MULTIARCH  := $(shell $(DPKG_ARCH) $(ha) -qDEB_HOST_MULTIARCH)
 
 # arrgh. future proofing
 ifeq ($(DEB_HOST_GNU_SYSTEM), linux)

=== modified file 'debian/control'
--- debian/control	2010-06-20 14:17:14 +0000
+++ debian/control	2011-11-07 02:12:26 +0000
@@ -5,16 +5,17 @@
 Homepage: http://flex.sf.net/
 Priority: optional
 Build-Depends: bison, gettext, texinfo, help2man, file, po-debconf,
-               autoconf, automake | automaken, autopoint
+               autoconf, automake | automaken, autopoint, dpkg-dev (>= 1.16.0)
 Maintainer: Manoj Srivastava <sriva...@debian.org>
 Standards-Version: 3.8.3.0
 
 Package: flex
 Architecture: any
 Pre-Depends: debconf | debconf-2.0
-Depends: ${shlibs:Depends}, m4, dpkg (>= 1.15.4) |  install-info
+Depends: ${shlibs:Depends}, m4, libfl-dev (= ${binary:Version}), dpkg (>= 1.15.4) |  install-info
 Recommends: gcc | c-compiler
 Suggests: bison, build-essential
+Multi-Arch: foreign
 Description: A fast lexical analyzer generator.
  Flex is a tool for generating scanners: programs which recognized lexical
  patterns in text. It reads the given input files for a description of a
@@ -40,3 +42,21 @@
  expressions. Whenever it finds one, it executes the corresponding C code.
  .
  This package contains the HTML documentation for flex.
+
+Package: libfl-dev
+Section: libdevel
+Priority: optional
+Architecture: any
+Multi-Arch: same
+Replaces: flex (<< 2.5.35-10ubuntu2)
+Description: static library for flex (a fast lexical analyzer generator).
+ Flex is a tool for generating scanners: programs which recognized lexical
+ patterns in text. It reads the given input files for a description of a
+ scanner to generate. The description is in the form of pairs of regular
+ expressions and C code, called rules. Flex generates as output a C source
+ file, lex.yy.c, which defines a routine yylex().  This file is compiled
+ and linked with the -lfl library to produce an executable. When the
+ executable is run, it analyzes its input for occurrences of the regular
+ expressions. Whenever it finds one, it executes the corresponding C code.
+ .
+ This package contains the static library for flex.

=== modified file 'debian/libfl.shared_object'
--- debian/libfl.shared_object	2008-11-10 15:25:58 +0000
+++ debian/libfl.shared_object	2011-11-07 01:43:47 +0000
@@ -19,5 +19,5 @@
  * arch-tag: ce35efb4-3893-42c7-bdcb-56d95beba2ac
  */
 
-INPUT( /usr/lib/libfl_pic.a )
+INPUT( /usr/lib/#DEB_HOST_MULTIARCH#/libfl_pic.a )
 

=== modified file 'debian/local-vars.mk'
--- debian/local-vars.mk	2009-04-28 11:30:31 +0000
+++ debian/local-vars.mk	2011-11-07 01:44:34 +0000
@@ -82,7 +82,7 @@
 
 
 BINDIR  = $(TMPTOP)$(PREFIX)/bin
-LIBDIR  = $(TMPTOP)$(PREFIX)/lib
+LIBDIR  = $(TMPTOP)$(PREFIX)/lib/$(DEB_HOST_MULTIARCH)
 MANDIR  = $(TMPTOP)$(PREFIX)/share/man
 DOCDIR  = $(TMPTOP)$(PREFIX)/share/doc/$(package)
 INFODIR = $(TMPTOP)$(PREFIX)/share/info

=== modified file 'debian/local.mk'
--- debian/local.mk	2009-10-30 14:52:46 +0000
+++ debian/local.mk	2011-11-07 02:12:10 +0000
@@ -27,6 +27,10 @@
 debian/stamp/INST/flex-doc:     debian/stamp/install/flex-doc
 debian/stamp/BIN/flex-doc:      debian/stamp/binary/flex-doc
 
+debian/stamp/BUILD/libfl-dev:    debian/stamp/build/flex
+debian/stamp/INST/libfl-dev:     debian/stamp/install/libfl-dev
+debian/stamp/BIN/libfl-dev:      debian/stamp/binary/libfl-dev
+
 CLN-common::
 	$(REASON)
 	$(MAKE) clean -C po || true
@@ -38,6 +42,9 @@
 CLEAN/flex-doc::
 	-rm -rf $(TMPTOP)
 
+CLEAN/libfl-dev::
+	-rm -rf $(TMPTOP)
+
 debian/stamp/conf/flex:
 	$(checkdir)
 	$(REASON)
@@ -111,29 +118,20 @@
 	rm -rf               $(TMPTOP)
 	$(make_directory)    $(TMPTOP)
 	$(make_directory)    $(BINDIR)
-	$(make_directory)    $(LIBDIR)
 	$(make_directory)    $(INFODIR)
 	$(make_directory)    $(MAN1DIR)
-	$(make_directory)    $(DOCDIR)
+	mkdir -p             $(TMPTOP)/usr/share/doc
+	ln -s                libfl-dev $(DOCDIR)
 	$(make_directory)    $(LINTIANDIR)
 	$(install_file)      debian/lintian.overrides $(LINTIANDIR)/$(package)
 	$(MAKE)              $(INT_INSTALL_TARGET)  prefix=$(TMPTOP)/usr \
 	                     infodir=$(INFODIR)     mandir=$(MANDIR)     \
                               INSTALL_PROGRAM="$(install_program)"
-	$(install_file)      debian/libfl.shared_object $(LIBDIR)/libfl.so
 	$(MAKE) install      -C po                  infodir=$(INFODIR) prefix=$(TMPTOP)/usr
 	$(MAKE) install-info -C doc                 infodir=$(INFODIR) prefix=$(TMPTOP)/usr
 	ln -s                flex                   $(BINDIR)/flex++
 	test ! -e            $(INFODIR)/dir         || rm -f $(INFODIR)/dir
 	test ! -e            $(INFODIR)/dir.old     || rm -f $(INFODIR)/dir.old
-	$(install_file)      README                 $(DOCDIR)/README
-	$(install_file)      debian/README          $(DOCDIR)/README.Debian 
-	$(install_file)      debian/NEWS.Debian     $(DOCDIR)/NEWS.Debian 
-	$(install_file)      NEWS                   $(DOCDIR)/NEWS
-	$(install_file)      debian/changelog       $(DOCDIR)/changelog.Debian
-	gzip -9frq           $(DOCDIR)/
-# Make sure the copyright file is not compressed
-	$(install_file)      debian/copyright       $(DOCDIR)/copyright
 	gzip -9fqr           $(MANDIR)/
 	test ! -e            $(INFODIR)/dir        || rm -f $(INFODIR)/dir
 	test ! -e            $(INFODIR)/dir.old    || rm -f $(INFODIR)/dir.old
@@ -143,12 +141,36 @@
               md5sum scan.l >      debian/scan.l.md5sum;                                 \
         fi
 	$(strip-exec)
-	$(strip-lib)
-	ln -s 	             NEWS.gz                $(DOCDIR)/changelog.gz
 	ln -s                flex.1.gz              $(MAN1DIR)/lex.1.gz
 	ln -s                flex.1.gz              $(MAN1DIR)/flex++.1.gz
 	ln -s                flex                   $(BINDIR)/lex
+	@test -d debian/stamp/install || mkdir -p debian/stamp/install
+	@echo done > $@
+
+debian/stamp/install/libfl-dev:
+	$(checkdir)
+	$(REASON)
+	$(TESTROOT)
+	rm -rf               $(TMPTOP)
+	$(make_directory)    $(TMPTOP)
+	$(make_directory)    $(LIBDIR)
+	$(make_directory)    $(DOCDIR)
+	mv                   debian/flex/usr/lib/* $(LIBDIR)
+	mv                   debian/flex/usr/include debian/libfl-dev/usr/include
+	$(install_file)      debian/libfl.shared_object $(LIBDIR)/libfl.so
+	sed -e 's,#DEB_HOST_MULTIARCH#,$(DEB_HOST_MULTIARCH),' \
+	 debian/libfl.shared_object > $(LIBDIR)/libfl.so
 	ln -s                libfl.a                $(LIBDIR)/libl.a
+	$(install_file)      README                 $(DOCDIR)/README
+	$(install_file)      debian/README          $(DOCDIR)/README.Debian 
+	$(install_file)      debian/NEWS.Debian     $(DOCDIR)/NEWS.Debian 
+	$(install_file)      NEWS                   $(DOCDIR)/NEWS
+	$(install_file)      debian/changelog       $(DOCDIR)/changelog.Debian
+	gzip -9frqn          $(DOCDIR)/
+# Make sure the copyright file is not compressed
+	$(install_file)      debian/copyright       $(DOCDIR)/copyright
+	$(strip-lib)
+	ln -s 	             NEWS.gz                $(DOCDIR)/changelog.gz
 	@test -d debian/stamp/install || mkdir -p debian/stamp/install
 	@echo done > $@
 
@@ -183,3 +205,16 @@
 	dpkg --build         $(TMPTOP) ..
 	@test -d debian/stamp/binary || mkdir -p debian/stamp/binary
 	@echo done > $@
+
+debian/stamp/binary/libfl-dev:
+	$(checkdir)
+	$(REASON)
+	$(TESTROOT)
+	$(make_directory)   $(TMPTOP)/DEBIAN
+	dpkg-gencontrol      -p$(package) -isp       -P$(TMPTOP)
+	$(create_md5sum)     $(TMPTOP)
+	chown -R root:root   $(TMPTOP)
+	chmod -R u+w,go=rX   $(TMPTOP)
+	dpkg --build         $(TMPTOP) ..
+	@test -d debian/stamp/binary || mkdir -p debian/stamp/binary
+	@echo done > $@

Attachment: signature.asc
Description: Digital signature

Reply via email to