Hi,
Sorry, the previous patch was wrong (it wasn't against a
properly-vanilla source version). I've re-checked this one!
Matthew
diff -ruN unchanged/gsl-1.8/debian/control gsl-1.8/debian/control
--- unchanged/gsl-1.8/debian/control 2008-10-28 17:50:01.000000000 +0000
+++ gsl-1.8/debian/control 2008-10-28 10:19:01.000000000 +0000
@@ -95,3 +95,19 @@
gsl-randist and gsl-histogram from the gsl-bin package.
.
URL: http://www.gnu.org/software/gsl/
+
+Package: libgsl0-prof
+Section: libdevel
+Priority: extra
+Architecture: any
+Depends: libgsl0 (= ${Source-Version})
+Description: GNU Scientific Library (GSL) -- Profiling Libraries
+ The GNU Scientific Library (GSL) is a collection of routines for
+ numerical analysis. The routines are written from scratch by the GSL
+ team in C, and present a modern API for C programmers, while allowing
+ wrappers to be written for very high level languages.
+ .
+ This package contains static libraries compiled with profiling info (-pg)
+ suitable for use with gprof.
+ .
+ URL: http://www.gnu.org/software/gsl/
diff -ruN unchanged/gsl-1.8/debian/libgsl0.docs gsl-1.8/debian/libgsl0.docs
--- unchanged/gsl-1.8/debian/libgsl0.docs 1970-01-01 01:00:00.000000000 +0100
+++ gsl-1.8/debian/libgsl0.docs 2008-10-28 14:19:50.000000000 +0000
@@ -0,0 +1,7 @@
+AUTHORS
+NEWS
+README
+TODO
+BUGS
+THANKS
+SUPPORT
diff -ruN unchanged/gsl-1.8/debian/libgsl0-prof.install gsl-1.8/debian/libgsl0-prof.install
--- unchanged/gsl-1.8/debian/libgsl0-prof.install 1970-01-01 01:00:00.000000000 +0100
+++ gsl-1.8/debian/libgsl0-prof.install 2008-10-28 14:57:57.000000000 +0000
@@ -0,0 +1 @@
+usr/lib/libgsl*p.a
diff -ruN unchanged/gsl-1.8/debian/README.Debian gsl-1.8/debian/README.Debian
--- unchanged/gsl-1.8/debian/README.Debian 1970-01-01 01:00:00.000000000 +0100
+++ gsl-1.8/debian/README.Debian 2008-10-28 16:29:28.000000000 +0000
@@ -0,0 +1,19 @@
+ Profiling GSL
+
+Sometimes when writing complex code, you may want to profile it using
+gprof. In this case, having libraries with profiling information
+compiled in is invaluable. It is possible to build your own .deb
+containing profiling libraries, that may be installed on your system
+in parallel to the usual libraries. To do this, follow these simple
+instructions:
+
+i) download the gsl source (and the build dependancies if necessary):
+apt-get source libgsl0
+apt-get build-dep libgsl0
+ii) build a binary profiling package:
+DEB_BUILD_OPTIONS=buildprof dpkg-buildpackage -b -rfakeroot -us -uc
+iii) install the resulting .deb
+dpkg -i ../libgsl0-prof_[version]_[arch].deb
+
+Finally, you need to specify -lgsl_p and -lgslcblas_p to link your
+program against the profiling libraries.
diff -ruN unchanged/gsl-1.8/debian/rules gsl-1.8/debian/rules
--- unchanged/gsl-1.8/debian/rules 2008-10-28 17:50:01.000000000 +0000
+++ gsl-1.8/debian/rules 2008-10-28 16:46:34.000000000 +0000
@@ -9,8 +9,10 @@
devpack := $(libpack)-dev
binpack := $(source)-bin
docpack := $(source)-doc-pdf
+profpack := $(libpack)-prof
debtmp := $(CURDIR)/debian/$(libpack)
debdoc := $(CURDIR)/debian/$(docpack)
+debprof := $(CURDIR)/debian/$(profpack)
arch := $(shell dpkg-architecture -qDEB_HOST_ARCH)
@@ -56,7 +58,22 @@
#lynx http://mirrors.rcn.net/pub/sourceware/gsl
lynx http://www.network-theory.co.uk/download/gsl
-configure: configure-stamp
+#different configure target if we want the profiling build
+ifneq (,$(findstring buildprof,$(DEB_BUILD_OPTIONS)))
+CONFIGTARGET = configure-prof-stamp
+INSTALLTARGET = install-prof-stamp
+BINARYTARGET = binary-prof
+CFLAGS += -pg
+export DH_OPTIONS =-N$(libpack) -N$(devpack) -N$(binpack) -N$(docpack) -p$(profpack)
+else
+CONFIGTARGET = configure-stamp
+INSTALLTARGET = install-stamp
+BINARYTARGET = binary-arch binary-indep
+export DH_OPTIONS =-N$(profpack)
+endif
+
+configure: $(CONFIGTARGET)
+
configure-stamp:
dh_testdir
dh_testdir
@@ -81,6 +98,21 @@
# end libtool rpath patch
touch configure-stamp
+configure-prof-stamp:
+ dh_testdir
+
+ ln -sf /usr/share/misc/config.sub .
+ ln -sf /usr/share/misc/config.guess .
+ rm -f config.cache
+
+ ./configure CFLAGS="$(CFLAGS)" \
+ --prefix=/usr \
+ --disable-shared \
+ --enable-static \
+ --with-gnu-ld \
+ $(CONFFLAGS)
+ touch configure-prof-stamp
+
build: configure build-stamp
build-stamp:
dh_testdir
@@ -120,13 +152,16 @@
dh_testdir
dh_testroot
rm -f build-stamp install-stamp test-stamp build-doc-stamp \
- configure-stamp install-doc-stamp
+ configure-stamp install-doc-stamp configure-prof-stamp \
+ install-prof-stamp
rm -rf debian/static/
-rm -f doc/*.pdf doc/*.dvi doc/*.log doc/*.ps
dh_clean lib/*so* build/*.so*
+ rm -f config.{guess,sub}
+ rm -rf $(debtmp) $(debdoc) $(debprof)
-$(MAKE) distclean
-install: install-stamp
+install: $(INSTALLTARGET)
install-stamp: test-stamp
$(MAKE) -f debian/rules DH_OPTIONS= install-work
install-work:
@@ -153,6 +188,20 @@
-p$(binpack) -p$(devpack)
touch install-stamp
+install-prof-stamp: test-stamp
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ $(MAKE) prefix=$(debtmp)/usr \
+ libdir=$(debtmp)/usr/lib \
+ infodir=$(debtmp)/usr/share/info \
+ includedir=$(debtmp)/usr/include \
+ mandir=$(debtmp)/usr/share/man install
+ #rename the profiling libraries
+ for lib in $(debtmp)/usr/lib/*.a ;\
+ do mv "$$lib" "$${lib%%.a}_p.a"; done
+ dh_install --sourcedir=$(debtmp)
+ touch install-prof-stamp
install-doc: install-doc-stamp
install-doc-stamp: build-doc
@@ -172,8 +221,7 @@
dh_testroot
#dh_installdebconf
dh_link
- dh_installdocs -p$(libpack) AUTHORS NEWS README TODO \
- BUGS THANKS SUPPORT
+ dh_installdocs
#dh_installexamples
#dh_installmenu
#dh_installemacsen
@@ -186,7 +234,7 @@
dh_compress
dh_fixperms
# dh_strip -N$(devpack)
- dh_strip --dbg-package=libgsl0-dbg
+ dh_strip -X_p.a --dbg-package=libgsl0-dbg
#dh_suidregister
dh_makeshlibs
dh_installdeb
@@ -198,16 +246,18 @@
# Build architecture independant packages using the common target.
binary-indep: build-doc install-doc
- $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
+ $(MAKE) -f debian/rules DH_OPTIONS="-i -N$(profpack)" binary-common
# Build architecture dependant packages using the common target.
binary-arch: build install
- $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
+ $(MAKE) -f debian/rules DH_OPTIONS="-a -N$(profpack)" binary-common
+
+binary-prof: binary-common
# Any other binary targets build just one binary package at a time.
#binary-%: build install
# make -f debian/rules binary-common DH_OPTIONS=-p$*
-binary: binary-arch binary-indep
+binary: $(BINARYTARGET)
.PHONY: build build-doc clean binary-indep binary-arch binary install \
install-doc test