Hi,

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.

Since splitting package is quite big deal, I'd like to get some feedback
from Manoj before jumping the gun.

Cheers,
Riku
diff -u flex-2.5.35/debian/local.mk flex-2.5.35/debian/local.mk
--- flex-2.5.35/debian/local.mk
+++ flex-2.5.35/debian/local.mk
@@ -27,6 +27,11 @@
 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 +43,9 @@
 CLEAN/flex-doc::
 	-rm -rf $(TMPTOP)
 
+CLEAN/libfl-dev::
+	-rm -rf $(TMPTOP)
+
 debian/stamp/conf/flex:
 	$(checkdir)
 	$(REASON)
@@ -111,7 +119,6 @@
 	rm -rf               $(TMPTOP)
 	$(make_directory)    $(TMPTOP)
 	$(make_directory)    $(BINDIR)
-	$(make_directory)    $(LIBDIR)
 	$(make_directory)    $(INFODIR)
 	$(make_directory)    $(MAN1DIR)
 	$(make_directory)    $(DOCDIR)
@@ -120,7 +127,6 @@
 	$(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++
@@ -148,7 +154,6 @@
 	ln -s                flex.1.gz              $(MAN1DIR)/lex.1.gz
 	ln -s                flex.1.gz              $(MAN1DIR)/flex++.1.gz
 	ln -s                flex                   $(BINDIR)/lex
-	ln -s                libfl.a                $(LIBDIR)/libl.a
 	@test -d debian/stamp/install || mkdir -p debian/stamp/install
 	@echo done > $@
 
@@ -163,6 +168,32 @@
 	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 > $@
+
+debian/stamp/install/libfl-dev:
+	$(checkdir)
+	$(REASON)
+	$(TESTROOT)
+	rm -rf               $(TMPTOP)
+	$(make_directory)    $(TMPTOP)
+	$(make_directory)    $(LIBDIR)
+	mv                   debian/flex/usr/lib/* $(LIBDIR)
+	$(install_file)      debian/libfl.shared_object $(LIBDIR)/libfl.so
+	ln -s                libfl.a                $(LIBDIR)/libl.a
+	@test -d debian/stamp/install || mkdir -p debian/stamp/install
+	@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
diff -u flex-2.5.35/debian/local-vars.mk flex-2.5.35/debian/local-vars.mk
--- flex-2.5.35/debian/local-vars.mk
+++ flex-2.5.35/debian/local-vars.mk
@@ -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
diff -u flex-2.5.35/debian/changelog flex-2.5.35/debian/changelog
--- flex-2.5.35/debian/changelog
+++ flex-2.5.35/debian/changelog
@@ -1,3 +1,16 @@
+flex (2.5.35-10ubuntu2) natty; urgency=low
+
+  * Create libfl-dev package to allow multiarch cross-compiling
+
+ -- Riku Voipio <riku.voi...@iki.fi>  Wed, 20 Jul 2011 17:02:57 +0300
+
+flex (2.5.35-10ubuntu1) natty; urgency=low
+
+  * debian/control: flex should be declared Multi-Arch: allowed since it
+    contains both an executable and a library.
+
+ -- Steve Langasek <steve.langa...@ubuntu.com>  Wed, 26 Jan 2011 14:48:22 -0800
+
 flex (2.5.35-10) unstable; urgency=low
 
   * Bug fix: "flex is not GNU flex", thanks to Santiago Vila
diff -u flex-2.5.35/debian/control flex-2.5.35/debian/control
--- flex-2.5.35/debian/control
+++ flex-2.5.35/debian/control
@@ -12,9 +12,10 @@
 Package: flex
 Architecture: any
 Pre-Depends: debconf | debconf-2.0
-Depends: ${shlibs:Depends}, m4, dpkg (>= 1.15.4) |  install-info
+Depends: ${shlibs:Depends}, libfl-dev, m4, dpkg (>= 1.15.4) |  install-info
 Recommends: gcc | c-compiler
 Suggests: bison, build-essential
+Multi-Arch: allowed
 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
@@ -42,0 +44,18 @@
+
+Package: libfl-dev
+Section: libdevel
+Replaces: flex (<=2.5.35-10ubuntu1)
+Priority: optional
+Architecture: any
+Multi-Arch: same
+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.

Reply via email to