debian swirl logo

Back to the packages list libgdchart-gd2

#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2004-2007 Jonas Smedegaard 

include /usr/share/cdbs/1/rules/upstream-tarball.mk
include /usr/share/cdbs/1/class/makefile-vars.mk
include /usr/share/cdbs/1/rules/debhelper.mk

package= libgdchart-gd2
library= libgdc

DEB_UPSTREAM_URL = http://www.fred.net/brv/chart
DEB_UPSTREAM_PACKAGE = gdchart
DEB_UPSTREAM_TARBALL_BASENAME = $(DEB_UPSTREAM_PACKAGE)$(DEB_UPSTREAM_TARBALL_VERSION)dev
DEB_UPSTREAM_TARBALL_MD5 = a4af7bc927d8b88934da56fce10a7a3c

DEB_DH_MAKESHLIBS_ARGS_$(package)-xpm = -V'$(package)-xpm'
DEB_DH_MAKESHLIBS_ARGS_$(package)-noxpm = -V'$(package)-noxpm | $(package)-xpm'

DEB_INSTALL_DIRS_ALL = usr/lib
DEB_INSTALL_DIRS_$(package)-xpm-dev = usr/include
DEB_INSTALL_DIRS_$(package)-noxpm-dev = usr/include

DEB_INSTALL_EXAMPLES_$(package)-xpm-dev = gdc_samp1.c gdc_samp2.c gdc_pie_samp.c ft_samp.c
DEB_INSTALL_EXAMPLES_$(package)-noxpm-dev = gdc_samp1.c gdc_samp2.c gdc_pie_samp.c ft_samp.c

# Dummy main build target (we build multiple targets)
DEB_BUILD_MAKE_TARGET = clean

version := $(shell expr `pwd` : '.*-\([0-9.]*\)')
version_major := $(shell expr `pwd` : '.*-\([0-9]*\).[0-9.]*')

INCLUDEDIRS = -I. -I.. -I/usr/include/freetype2 -I/usr/include/freetype2/freetype
LIBS = -lc -lm -L/usr/lib -lpng -lz -ljpeg -lfreetype -lgd

CFLAGS += -D_REENTRANT -pipe -DHAVE_LIBPNG -DHAVE_LIBFREETYPE -DHAVE_LIBJPEG -fsigned-char
CFLAGS_$(package)-xpm = $(CFLAGS) -fPIC -DHAVE_XPM
CFLAGS_$(package)-noxpm = $(CFLAGS) -fPIC
CFLAGS_$(package)-xpm-dev = $(CFLAGS) -DHAVE_XPM
CFLAGS_$(package)-noxpm-dev = $(CFLAGS)

# Build shared libc6 library.
build/$(package)-xpm::
		make clean	
		dh_testdir
		-mkdir $(package)-xpm
		cd $(package)-xpm && \
			$(DEB_MAKE_INVOKE) -f ../Makefile VPATH=".." srcdir=".." \
		INCLUDEDIRS= "$(INCLUDEDIRS) -I/usr/include/X11" \
			$(library).a
		cd $(package)-xpm && \
			gcc -shared -D_REENTRANT \
			-Wl,-soname,$(library).so.$(version_major) \
			-o $(library).so.$(version) \
			`echo *.o` \
			$(LIBS) -L/usr/X11R6/lib -lXpm -lX11

# Build shared libc6 library without XPM support.
build/$(package)-noxpm::
		make clean	
		dh_testdir
		-mkdir $(package)-noxpm
		cd $(package)-noxpm && \
			$(DEB_MAKE_INVOKE) -f ../Makefile VPATH=".." srcdir=".." \
		INCLUDEDIRS= "$(INCLUDEDIRS)" \
			$(library).a
		cd $(package)-noxpm && \
			gcc -shared -D_REENTRANT \
			-Wl,-soname,$(library).so.$(version_major) \
			-o $(library).so.$(version) \
			`echo *.o` \
			$(LIBS)

# Build static libc6 library.
build/$(package)-xpm-dev::
		make clean
		dh_testdir
		-mkdir $(package)-xpm-dev
		cd $(package)-xpm-dev && \
			$(DEB_MAKE_INVOKE) -f ../Makefile VPATH=".." srcdir=".." \
		INCLUDEDIRS= "$(INCLUDEDIRS) -I/usr/include/X11" \
			$(library).a

# Build static libc6 library without XPM support.
build/$(package)-noxpm-dev::
		make clean
		dh_testdir
		-mkdir $(package)-noxpm-dev
		cd $(package)-noxpm-dev && \
			$(DEB_MAKE_INVOKE) -f ../Makefile VPATH=".." srcdir=".." \
		INCLUDEDIRS= "$(INCLUDEDIRS)" \
			$(library).a

clean::
		rm -rf $(package)-xpm $(package)-noxpm $(package)-xpm-dev $(package)-noxpm-dev

binary-install/$(package)-xpm::
		install -m644 $(package)-xpm/$(library).so.$(version) debian/$(package)-xpm/usr/lib/
		ln -sf $(library).so.$(version) debian/$(package)-xpm/usr/lib/$(library).so.$(version_major)

binary-install/$(package)-noxpm::
		install -m644 $(package)-noxpm/$(library).so.$(version) debian/$(package)-noxpm/usr/lib/
		ln -sf $(library).so.$(version) debian/$(package)-noxpm/usr/lib/$(library).so.$(version_major)

binary-install/$(package)-xpm-dev::
		install -m644 $(package)-xpm-dev/$(library).a debian/$(package)-xpm-dev/usr/lib
		install -m644 *.h debian/$(package)-xpm-dev/usr/include
		ln -sf $(library).so.$(version) debian/$(package)-xpm-dev/usr/lib/$(library).so

binary-install/$(package)-noxpm-dev::
		install -m644 $(package)-noxpm-dev/$(library).a debian/$(package)-noxpm-dev/usr/lib
		install -m644 *.h debian/$(package)-noxpm-dev/usr/include
		ln -sf $(library).so.$(version) debian/$(package)-noxpm-dev/usr/lib/$(library).so

# Let d-shlibs calculate development package dependencies
#  Suppress pre-sarge X11 fallback dependencies (bugreport not yet filed)
#  Favor -noxpm flavor of libgd, as we don't actually use the XPM calls
### TODO: Let d-shlibs intelligently handle shared library install
##common-binary-post-install-arch::
##	d-shlibmove --commit --movedev "*.h" usr/include/ $(package)-xpm/$(library).so
binary-fixup/$(package)-xpm-dev::
		d-devlibdeps \
			--override 's/ | xlibs-dev (<< 4.3.0)//' \
			--override 's/libgd-dev/libgd2-noxpm-dev | libgd-dev/' \
			--override 's/libgd3-dev/libgd-dev/' \
			debian/$(package)-xpm-dev.substvars $(package)-xpm/$(library).so.$(version)

binary-fixup/$(package)-noxpm-dev::
		d-devlibdeps \
			--override 's/ | xlibs-dev (<< 4.3.0)//' \
			--override 's/libgd-dev/libgd2-noxpm-dev | libgd-dev/' \
			--override 's/libgd3-dev/libgd-dev/' \
			debian/$(package)-noxpm-dev.substvars $(package)-noxpm/$(library).so.$(version)

# Little hack to have CDBS recognize readme.txt as main README file.
common-install-arch common-install-indep::
		cp -fp README.txt README

clean::
		rm -f README

# Needed by upstream build process for all flavors
CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), libgd2-noxpm-dev (>> 2.0.28)

# Needed by upstream build process for xpm flavor
CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), libxpm-dev, libxt-dev

# Needed for our packaging
#  We need the fix for bug#440728 to fix bug#427326
CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), d-shlibs (>= 0.35)

# Fix double cdbs build-dependencies
CDBS_BUILD_DEPENDS := $(shell echo '$(CDBS_BUILD_DEPENDS)' | sed -e '/\bcdbs (>= 0.4.39)/ s/ *,* *\bcdbs (>= \(0.4.23-1.1\|0.4.27\)) *,* */, /g' -e 's/^ *, *//' -e 's/ *, *$$//')

Builds:

libgdchart-gd2-noxpm-dev
generate graphs using the gd library (development version)
libgdchart-gd2-noxpm
generate graphs using the gd library
libgdchart-gd2-xpm-dev
generate graphs using the gd library (development version)
libgdchart-gd2-xpm
generate graphs using the gd library