tags 503290 patch
quit
I still I always prefer something minimally invasive.
Right, I've sorted this. The attached patch (which includes an
explanatory README.Debian) means you can do:
DEB_BUILD_OPTIONS=buildprof dpkg-buildpackage -b -rfakeroot -us -uc
and get a libgsl0-prof .deb which you can install.
The normal build does not produce a -prof package. The only thing I've
not done is provide a changelog entry ;-)
HTH,
Matthew
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 16:45:38.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)
@@ -59,10 +61,15 @@
#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
-DH_OPTIONS = "-Nlibgsl0-prof"
+INSTALLTARGET = install-stamp
+BINARYTARGET = binary-arch binary-indep
+export DH_OPTIONS =-N$(profpack)
endif
configure: $(CONFIGTARGET)
@@ -106,7 +113,6 @@
$(CONFFLAGS)
touch configure-prof-stamp
-
build: configure build-stamp
build-stamp:
dh_testdir
@@ -146,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:
@@ -179,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
@@ -198,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
@@ -212,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
@@ -224,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