1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
|
#!/usr/bin/make -f
export DH_COMPAT=5
# Change this on API breakage
export LIBPTCOMPAT=1.9.3
export LIBPTCOMPAT2=1.10.0
export LIBPTCOMPAT3=1.10.1
#PACKAGE=libpt-$(LIBPTCOMPAT)
PACKAGE=libpt-1.10.0
# can err if the tarball is not yet extracted
VER_MAJOR := $(shell awk '/MAJOR_VERSION/ { print $$3 }' version.h 2>/dev/null)
VER_MINOR := $(shell awk '/MINOR_VERSION/ { print $$3 }' version.h 2>/dev/null)
VER_SUB := $(shell awk '/BUILD_NUMBER/ { print $$3 }' version.h 2>/dev/null)
SHLIBSVER := $(VER_MAJOR).$(VER_MINOR).$(VER_SUB)
CFLAGS = -g -Wall
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
endif
export CFLAGS
# used for sed-ating out host specific data
export UNAME_R=`uname -r`
export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
confflags += --build $(DEB_HOST_GNU_TYPE)
else
confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif
# Ensure the build aborts when there are still references to undefined
# symbols.
LDFLAGS += -Wl,-z,def
DEBVERSION:=$(shell head -n 1 debian/changelog \
| sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
UPVERSION:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9.]*$$//' -e 's/.dfsg$$//')
URLVERSION:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9.]*$$//' -e 's/.dfsg$$//' -e 's/\./_/g')
FILENAME := pwlib_$(UPVERSION)~dfsg.orig.tar.gz
UPFILENAME := pwlib_$(UPVERSION).orig.tar.gz
URL := http://www.voxgratia.org/releases/pwlib-v$(URLVERSION)-src.tar.gz
include /usr/share/dpatch/dpatch.make
build: build-arch build-indep
build-arch: config.status build-arch-stamp
config.status: patch-stamp autotools
./configure $(confflags) --enable-plugins --enable-v4l2 --prefix=/usr
autotools:
rm -f config.sub config.guess
cp /usr/share/misc/config.sub config.sub
cp /usr/share/misc/config.guess config.guess
rm -f plugins/config.sub plugins/config.guess
cp /usr/share/misc/config.sub plugins/config.sub
cp /usr/share/misc/config.guess plugins/config.guess
touch autotools
build-arch-stamp:
# Compile it all, first static and then shared, so we get shared bins
$(MAKE) PWLIBDIR=$(CURDIR) optnoshared clean
$(MAKE) PWLIBDIR=$(CURDIR) -C samples/hello_world/ optnoshared
samples/hello_world/obj_*_r/hello
$(MAKE) PWLIBDIR=$(CURDIR) -C samples/hello_world/ clean
$(MAKE) PWLIBDIR=$(CURDIR) optshared
# try if our build actually works ;)
$(MAKE) PWLIBDIR=$(CURDIR) -C samples/hello_world/ optshared
LD_LIBRARY_PATH=$(CURDIR)/lib samples/hello_world/obj_*_r/hello
$(MAKE) PWLIBDIR=$(CURDIR) -C samples/hello_world/ clean
# if this won't work, we needn't even try going any further...
touch build-arch-stamp
build-indep: build-indep-stamp
build-indep-stamp:
$(MAKE) PWLIBDIR=$(CURDIR) docs
touch build-indep-stamp
clean: clean-patched unpatch
clean-patched:
$(checkdir)
-rm -f build-arch-stamp build-indep-stamp patch-stamp
-if [ -f Makefile ];then \
$(MAKE) PWLIBDIR=$(CURDIR) clean || true;\
fi
-rm -f include/ptbuildopts.h
-rm -f Makefile config.log config.status autotools
-rm -f config.sub config.guess plugins/config.sub plugins/config.guess
-rm -rf lib
-rm -f make/ptbuildopts.mak make/ptlib-config
-rm -rf plugins/pwlib
-rm -f plugins/Makefile plugins/config.status plugins/config.log
-rm -f `find . -name "*~"`
-rm -rf `find debian/* -type d -name "libpt-*"`
-rm -rf debian/files* core
-rm -f debian/*substvars
-rm -f debian/*.debhelper
-rm -rf html
-rm -f debian/libpt-*.*.docs
-rm -f core a.out
dh_clean
install: install-indep install-arch
install-indep:
dh_testdir
dh_testroot
dh_clean -k -i
dh_installdirs -i
install-arch:
dh_testdir
dh_testroot
dh_clean -k -a
dh_installdirs -a
#INSTALL#
$(MAKE) -C src/ptlib/unix install PWLIBDIR=$(CURDIR) INSTALL_DIR=$(CURDIR)/debian/$(PACKAGE)/usr
ifneq ($(SHLIBSVER),$(LIBPTCOMPAT))
ln -s libpt.so.$(SHLIBSVER) \
debian/$(PACKAGE)/usr/lib/libpt.so.$(LIBPTCOMPAT)
endif
ifneq ($(SHLIBSVER),$(LIBPTCOMPAT2))
ln -s libpt.so.$(SHLIBSVER) \
debian/$(PACKAGE)/usr/lib/libpt.so.$(LIBPTCOMPAT2)
endif
ifneq ($(SHLIBSVER),$(LIBPTCOMPAT3))
ln -s libpt.so.$(SHLIBSVER) \
debian/$(PACKAGE)/usr/lib/libpt.so.$(LIBPTCOMPAT3)
endif
# libpt-dev
dh_movefiles -plibpt-dev --sourcedir=debian/$(PACKAGE) usr/lib/libpt.so
-rm -f debian/$(PACKAGE)/usr/lib/libpt.so.? \
debian/$(PACKAGE)/usr/lib/libpt.so.?.?
cp -vr include/pt* debian/libpt-dev/usr/include
cp -vr make `pwd`/debian/libpt-dev/usr/share/pwlib
-rm -f `pwd`/debian/libpt-dev/usr/share/pwlib/make/unix.mak*
sed -e 's/$$(PWLIBDIR)\/include\/ptlib\/unix/\/usr\/include\/ptlib\/unix/g' \
-e 's/$$(PWLIBDIR)\/lib/\/usr\/lib/g' \
make/unix.mak > debian/libpt-dev/usr/share/pwlib/make/unix.mak
cp lib/libpt.a debian/libpt-dev/usr/lib
find debian/libpt-dev/usr/include -type f -exec chmod 644 {} \;
# ptlib-config in libpt-dev
# changing build/machine dependent data in ptlib-config
-rm -f `find debian/libpt-dev/ -name ptlib-config`
sed -e 's#^OSRELEASE=.*#OSRELEASE=\"\"#g' \
-e 's#^LIBDIR=.*#LIBDIR=\"/usr/lib\"#g' \
-e 's#^\(CCFLAGS=.*-DP_LINUX\)='$(UNAME_R)'\(.*\)\"#\1 \2 -DPHAS_TEMPLATES -I/usr/include/ptlib -I/usr/include/ptlib/unix\"#g' \
-e 's#^\(LIBS=.*\)\"#\1 -lpt\"#g' \
make/ptlib-config > debian/libpt-dev/usr/bin/ptlib-config
chmod 0755 debian/libpt-dev/usr/bin/ptlib-config
ln -s ../../../bin/ptlib-config debian/libpt-dev/usr/share/pwlib/make/
# erasing build host specific && unnecessary stuff off ptbuildopts.mak
-rm -f `find debian/libpt-dev/ -name ptbuildopts.mak`
sed -e 's#^PWLIBDIR.*#PWLIBDIR = /usr/share/pwlib#g' \
-e 's#^OSRELEASE.*#OSRELEASE =#g' \
-e 's#^\(STDCCFLAGS.*-DP_LINUX\)='$(UNAME_R)'\(.*\)#\1 \2#g' \
make/ptbuildopts.mak > debian/libpt-dev/usr/share/pwlib/make/ptbuildopts.mak
# for using /usr/share/pwlib as a single PWLIBDIR
ln -s ../../lib debian/libpt-dev/usr/share/pwlib
cp version.h debian/libpt-dev/usr/include/ptlib
ln -s ../../include/ptlib/version.h debian/libpt-dev/usr/share/pwlib
ln -s ../../../include/ptbuildopts.h debian/libpt-dev/usr/share/pwlib/include
ln -s ../../../include/ptlib.h debian/libpt-dev/usr/share/pwlib/include
ln -s ../../../include/ptlib debian/libpt-dev/usr/share/pwlib/include
# should not be part of a distribution package:
-rm -f `find debian/libpt-dev/ -name "*.in"`
# plugins
#libpt-plugins-v4l
cp plugins/pwlib/device/videoinput/v4l_pwplugin.so \
debian/libpt-plugins-v4l/usr/lib/pwlib/device/videoinput/
#libpt-plugins-v4l2
cp plugins/pwlib/device/videoinput/v4l2_pwplugin.so \
debian/libpt-plugins-v4l2/usr/lib/pwlib/device/videoinput/
#libpt-plugins-avc
cp plugins/pwlib/device/videoinput/avc_pwplugin.so \
debian/libpt-plugins-avc/usr/lib/pwlib/device/videoinput/
#libpt-plugins-dc
cp plugins/pwlib/device/videoinput/dc_pwplugin.so \
debian/libpt-plugins-dc/usr/lib/pwlib/device/videoinput/
#libpt-plugins-oss
cp plugins/pwlib/device/sound/oss_pwplugin.so \
debian/libpt-plugins-oss/usr/lib/pwlib/device/sound/
#libpt-plugins-alsa
cp plugins/pwlib/device/sound/alsa_pwplugin.so \
debian/libpt-plugins-alsa/usr/lib/pwlib/device/sound/
cp debian/libpt.docs debian/$(PACKAGE).docs
# Must not depend on anything. This is to be called by
# binary-arch/binary-multi
# in another 'make' thread.
binary-common:
dh_testdir
dh_testroot
dh_installdocs
dh_installman
dh_installchangelogs ChangeLog
# Remove all CVS sub-directories
find debian -name "CVS" -type d|xargs rm -rf
find debian -name .cvsignore -exec rm -f {} \;
dh_link
dh_compress
dh_fixperms
dh_makeshlibs -V "$(PACKAGE) (>= $(DEBVERSION))"
dh_installdeb
dh_shlibdeps -L $(PACKAGE) -l debian/$(PACKAGE)/usr/lib
dh_gencontrol
dh_md5sums
dh_builddeb
binary-strip:
dh_testdir
dh_testroot
ifneq (5,$(DH_COMPAT))
dh_strip --dbg-package=libpt-dbg
else
# As dh_strip does not work fine for multiple binary package
# we need to workaround that manually
dh_strip --exclude=libpt_d --keep-debug
for pack in $(PACKAGE) libpt-plugins-alsa libpt-plugins-oss \
libpt-plugins-v4l libpt-plugins-v4l2 libpt-plugins-avc \
libpt-plugins-dc ; \
do \
cp -af debian/$$pack/usr/lib/debug debian/libpt-dbg/usr/lib && \
rm -rf debian/$$pack/usr/lib/debug; \
done
endif
# Build architecture independant packages using the common target.
binary-indep: build-indep install-indep
$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
# Build architecture dependant packages using the common target.
binary-arch: build-arch install-arch
$(MAKE) -f debian/rules DH_OPTIONS=-a binary-strip
$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
print-version:
@@echo "Debian version: $(DEBVERSION)"
@@echo "Upstream version: $(UPVERSION)"
get-orig-source:
@@dh_testdir
@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
ifneq (,$(findstring dfsg,$(DEBVERSION)))
@@echo Downloading $(UPFILENAME) from $(URL) for repacking ...
@@wget -N -nv -T10 -t3 -O ../tarballs/$(UPFILENAME) $(URL)
@@echo Repacking as DFSG-free...
@@mkdir -p ../tarballs/pwlib-$(UPVERSION).tmp/
@@cd ../tarballs/pwlib-$(UPVERSION).tmp ; \
tar xfz ../$(UPFILENAME)
@@rm -f ../tarballs/pwlib-$(UPVERSION).tmp/pwlib*/samples/xmpptest/draft-ietf-*
@@echo Writing archive ../tarballs/$(FILENAME)
@@cd ../tarballs/pwlib-$(UPVERSION).tmp ; \
tar cfz ../$(FILENAME) *
@@echo Cleaning up...
@@$(RM) -rf ../tarballs/pwlib-$(UPVERSION).tmp/ ../tarballs/$(UPFILENAME)
else
@@echo Downloading $(UPFILENAME) from $(URL) ...
@@wget -N -nv -T10 -t3 -O ../tarballs/$(UPFILENAME) $(URL)
@@if ( tar tfvz ../tarballs/$(UPFILENAME)|grep -q draft-ietf- );then \
echo Upstream release not DFSG-clean, removing.; \
$(RM) ../tarballs/$(UPFILENAME);false; \
else \
echo Ready for packaging.;\
fi
endif
binary: binary-arch binary-indep
.PHONY: build clean clean-patched binary-indep binary-arch binary install install-indep install-arch
|