Debian-Paket mit debug-Informationen übersetzen

Vom einfachen Programm zum fertigen Debian-Paket, Fragen rund um Programmiersprachen, Scripting und Lizenzierung.
Antworten
Benutzeravatar
hupfdule
Beiträge: 1864
Registriert: 09.12.2002 15:04:37
Wohnort: Berlin
Kontaktdaten:

Debian-Paket mit debug-Informationen übersetzen

Beitrag von hupfdule » 27.05.2003 10:36:46

Hallo, ich möchte nun ein Paket (genauer centericq) mit debug-Informationen übersetzen. Nur leider fällt mir das nicht wirklich leicht. Wo gebe ich denn die Compiler-Anweisung an? In debian/rules? Oder wo sonst?
Das hier ist die bisherige debian/rules:

Code: Alles auswählen

#!/usr/bin/make -f
#                                                       -*- makefile -*-
# debian/rules file for the Debian/GNU Linux centericq package
# Copyright 2002-2003 by Julien LEMOINE <speedblue@debian.org>

#include dpatch makefile
include /usr/share/dpatch/dpatch.make

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

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

source          := $(shell head -1 debian/changelog | \
                        perl -nle 'm/^([a-z]+)/ and print $$1')
package         := $(shell head -1 debian/changelog | \
                        perl -nle 'm/^(\S+)\s+/ and print $$1')
version         := $(shell head -1 debian/changelog | \
                        perl -nle 'm/\S+\s+\((\S+)-\S+\)/ and print $$1')
major           := $(shell head -1 debian/changelog | perl -nle \
                        'm/\S+\s+\((\d\.\d)\.\d+-\S+\)/ and print $$1')
pcommon=$(package)-common
pfribidi=$(package)-fribidi

config.status: configure
        dh_testdir
        cp centericq.1 centericq-fribidi.1
        CFLAGS="$(CXXFLAGS)" CXXFLAGS="$(CXXFLAGS)" ./configure \
        --host=$(DEB_HOST_GNU_TYPE)                             \
        --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr             \
        --mandir=\$${prefix}/share/man                          \
        --infodir=\$${prefix}/share/info                        \
        --with-included-gettext --with-ssl || cat config.log

build: patch build-stamp

build-stamp: config.status
        dh_testdir
        $(MAKE)
        mv src/centericq src/centericq-normal
        $(MAKE) distclean
        CFLAGS="$(CXXFLAGS)" CXXFLAGS="$(CXXFLAGS)" ./configure \
        --host=$(DEB_HOST_GNU_TYPE)                             \
        --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr             \
        --mandir=\$${prefix}/share/man                          \
        --infodir=\$${prefix}/share/info                        \
        --with-included-gettext --with-fribidi=/usr --with-ssl
        $(MAKE)
        mv src/centericq src/centericq-fribidi
        touch build-stamp

clean: unpatch
        dh_testdir
        dh_testroot
        -$(MAKE) distclean
        rm -f build-stamp intl/libintl.h config.cache           \
        config.guess config.log config.status config.sub        \
        config.h config.sub src/centericq-normal                \
        src/centericq-fribidi centericq-fribidi.1               \
        po/centericq.pot po/cat-id-tbl.c po/*.gmo
        find ./ -name config.status -print | xargs rm || true
        find ./ -name config.log -print | xargs rm || true
        -test -r /usr/share/misc/config.sub &&                  \
          cp -f /usr/share/misc/config.sub config.sub &&        \
          cp -f /usr/share/misc/config.sub kkconsui-0.1/config.sub
        -test -r /usr/share/misc/config.guess &&                \
          cp -f /usr/share/misc/config.guess config.guess &&    \
          cp -f /usr/share/misc/config.guess kkconsui-0.1/config.guess
        dh_cleaninstall: build
        dh_testdir
        dh_testroot
        dh_clean -k
        dh_installdirs
        $(MAKE) install-data prefix=$(CURDIR)/debian/$(pcommon)/usr
        mv src/centericq-normal src/centericq
        install -m 755 src/centericq $(CURDIR)/debian/$(package)/usr/bin/
        install -m 755 src/centericq-fribidi $(CURDIR)/debian/$(pfribidi)/usr/bin
        rm -rf $(CURDIR)/debian/$(pcommon)/usr/share/man/man1/
        install -m 755 misc/cicqconv $(CURDIR)/debian/$(pcommon)/usr/bin
        install -m 755 misc/cicqsync $(CURDIR)/debian/$(pcommon)/usr/bin

binary-indep: build install

binary-arch: build install
        dh_testdir
        dh_testroot
        dh_installdocs
        dh_installman -p$(pcommon) misc/cicqconv.1 misc/cicqsync.1
        dh_installman -p$(package) centericq.1
        dh_installman -p$(pfribidi) centericq-fribidi.1
        dh_installchangelogs ChangeLog
        dh_link
        dh_strip
        dh_compress
        dh_fixperms
        dh_installdeb
        dh_shlibdeps
        dh_gencontrol
        dh_md5sums
        dh_builddeb

binary: binary-indep binary-arch 
.PHONY: build clean binary-indep binary-arch binary install 
Nun steht da ja 'CXXFLAGS = -Wall -g'. Das müsste doch eigentlich die debug-Infos mit rein bringen. Oder hab ich da was falsch verstanden? Ich muss zugeben, dass ich die rules-Datei nicht wirklich verstehe.....
Wo kann ich diese Option sonst noch angeben?

Benutzeravatar
zyta2k
Beiträge: 2446
Registriert: 14.03.2003 09:18:00
Kontaktdaten:

Beitrag von zyta2k » 27.05.2003 11:22:01

Uppppps :)

Man lernt nie aus *gg*

Aus der debian-policy

--snip--

By default, when a package is being built, any binaries created should include debugging information, as well as being compiled with optimization. ... For the C programming language, this means the following compilation parameters should be used:

CC = gcc
CFLAGS = -O2 -g -Wall # sane warning options vary between programs
LDFLAGS = # none
install -s # (or use strip on the files in debian/tmp)

Although binaries in the build tree should be compiled with debugging information by default, it can often be difficult to debug programs if they are also subjected to compiler optimization. For this reason, it is recommended to support the standardized environment variable DEB_BUILD_OPTIONS. This variable can contain several flags to change how a package is compiled and built.

noopt
The presence of this string means that the package should be complied with a minimum of optimization. For C programs, it is best to add -O0 to CFLAGS (although this is usually the default). Some programs might fail to build or run at this level of optimization; it may be necessary to use -O1, for example.

nostrip
This string means that the debugging symbols should not be stripped from the binary during installation, so that debugging information may be included in the package.

--end snip--

so gesehen wird also ein normales debian paket (wie du richtig gesagt hast) mit -g -Wall -O2 gebaut.
Dies kann jedoch wegen dem O2 dazu führen, dass nur ein Teil debugbar ist.

Um ein Full-Debug Binary zu bekommen musst du also noch die Variable DEB_BUILD_OPTIONS setzen.

export DEB_BUILD_OPTIONS="nostrip noopt"

Greetz
zyta2k (der auch mal wieder was dazugelernt hat ;) )

Benutzeravatar
hupfdule
Beiträge: 1864
Registriert: 09.12.2002 15:04:37
Wohnort: Berlin
Kontaktdaten:

Beitrag von hupfdule » 27.05.2003 12:59:45

Ja, genau. Das hat geholfen! Danke :)

Antworten