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 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
|
#!/usr/bin/make -f
PACKAGE=libpt-1.10.10
ifneq (,$(shell test -f version.h&&grep MAJOR_VERSION version.h))
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)
endif
SHLIBSVER := $(VER_MAJOR).$(VER_MINOR).$(VER_SUB)
CFLAGS := -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
endif
# 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 -r -e 's/^.*://' -e 's/-[0-9.]*(\+b[0-9])?$$//' -e 's/.dfsg[0-9]*$$//')
URLVERSION := $(shell echo $(DEBVERSION) | sed -r -e 's/^.*://' -e 's/-[0-9.]*(\+b[0-9])?$$//' -e 's/.dfsg[0-9]*$$//' -e 's/\./_/g')
FILENAME := pwlib_$(UPVERSION)~dfsg1.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
./configure $(confflags) --enable-plugins --enable-v4l2 --enable-oss --enable-v4l --disable-avc --disable-dc --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: config.status
# first build static and shared...
# ### internal settings and variables structure:
# make/ptlib.mak
# -> make/unix.mak
# (P_SHAREDLIB = 0|1) - build shared library
# (OBJ_SUFFIX = r|d) - what object suffix will we use (removed with Debian patch)
# (OBJDIR_SUFFIX = $(OBJ_SUFFIX)) - what the target namespace for all the objects will be
# (LIB_TYPE = _s) # for static lib (P_SHAREDLIB = 0)
# (PW_LIBDIR = $(PWLIBDIR)/lib) - target where libpt.so.* will be built into
## PTLIB_BASE = pt_$(PLATFORM_TYPE)_$(OBJ_SUFFIX) --- this one is just "pt" for Debian
## PTLIB_FILE = lib$(PTLIB_BASE)$(LIB_TYPE).$(LIB_SUFFIX)
## PT_OBJBASE = obj_$(PLATFORM_TYPE)_$(OBJDIR_SUFFIX)
# (if not debian-patched)
# --> make/ptbuildopts.mak
# -> make/common.mak
# PTLIB_BASE=pt
# CFLAGS += -DPTRACING=1
# 1. shared, with ptrace but opt: DEBUG=0 P_SHAREDLIB=1 OBJDIR_SUFFIX=r optshared
# 2. static, with ptrace but opt: DEBUG=0 P_SHAREDLIB=0 OBJDIR_SUFFIX=r optnoshared
# put CFLAGS to build with PTRACING code
$(MAKE) PWLIBDIR=$(CURDIR) CFLAGS="$(CFLAGS) -DPTRACING=1" optshared
$(MAKE) PWLIBDIR=$(CURDIR) CFLAGS="$(CFLAGS) -DPTRACING=1" optnoshared
# then we ensure that the fresh build works with hello world.
# ...in static
$(MAKE) PWLIBDIR=$(CURDIR) -C samples/hello_world/ clean
$(RM) -rf samples/hello_world/obj_*
# put CFLAGS to build with PTRACING code
$(MAKE) PWLIBDIR=$(CURDIR) CFLAGS="$(CFLAGS) -DPTRACING=1" -C samples/hello_world/ optnoshared
samples/hello_world/obj_*_r/hello
# ...and in shared..
$(MAKE) PWLIBDIR=$(CURDIR) -C samples/hello_world/ clean
$(RM) -rf samples/hello_world/obj_*
$(MAKE) PWLIBDIR=$(CURDIR) CFLAGS="$(CFLAGS) -DPTRACING=1" -C samples/hello_world/ optshared
if (samples/hello_world/obj_*_r/hello 2>/dev/null);then \
echo opt hello_world sample incorrectly compiled static; false ; \
else \
echo opt hello_world sample correctly compiled non-static; \
fi
LD_LIBRARY_PATH=$(CURDIR)/lib samples/hello_world/obj_*_r/hello
# if this won't work, we needn't even try going any further...
# cleanup to make sure we don't install any of the samples we just compiled
$(MAKE) PWLIBDIR=$(CURDIR) -C samples/hello_world/ clean
$(RM) -rf samples/hello_world/obj_*
touch build-arch-stamp
build-indep: build-indep-stamp
build-indep-stamp: config.status
$(MAKE) docs
touch build-indep-stamp
debian/control: debian/control.in
sed -e 's#@@PACKAGE@@#$(PACKAGE)#g' debian/control.in >debian/control
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 ; \
$(MAKE) PWLIBDIR=$(CURDIR) -C samples/hello_world/ clean||true ; \
fi
rm -rf samples/hello_world/obj_*
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 -f plugins/Makefile plugins/config.status plugins/config.log
rm -rf lib
rm -f make/ptbuildopts.mak make/ptlib-config include/ptbuildopts.h
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 debian/libpt-*.*.manpages debian/libpt-*.*.dirs
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 -d -m 755 $(CURDIR)/debian/$(PACKAGE)/usr/lib
install -m 755 lib/libpt.so.*.*.* $(CURDIR)/debian/$(PACKAGE)/usr/lib
# $(PACKAGE)-dbg (will be filled by dh_strip)
cp debian/libpt-dbg.dirs debian/$(PACKAGE)-dbg.dirs
# $(PACKAGE)-dev
ln -s libpt.so.$(SHLIBSVER) debian/$(PACKAGE)-dev/usr/lib/libpt.so
cp -vr include/pt* debian/$(PACKAGE)-dev/usr/include
cp -vr make `pwd`/debian/$(PACKAGE)-dev/usr/share/pwlib
sed -i -e 's#$$(PWLIBDIR)/include/ptlib/unix#/usr/include/ptlib/unix#g' \
-e 's#$$(PWLIBDIR)/lib#/usr/lib#g' debian/$(PACKAGE)-dev/usr/share/pwlib/make/unix.mak
# copy static opt version to $(PACKAGE)-dev
install -m 755 lib/libpt_s.a debian/$(PACKAGE)-dev/usr/lib/
find debian/$(PACKAGE)-dev/usr/include -type f -exec chmod 644 {} \;
# ptlib-config in $(PACKAGE)-dev
# changing build/machine dependent data in ptlib-config
-rm -f `find debian/$(PACKAGE)-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/$(PACKAGE)-dev/usr/bin/ptlib-config
chmod 0755 debian/$(PACKAGE)-dev/usr/bin/ptlib-config
ln -s ../../../bin/ptlib-config debian/$(PACKAGE)-dev/usr/share/pwlib/make/
# erasing build host specific && unnecessary stuff off ptbuildopts.mak
-rm -f `find debian/$(PACKAGE)-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/$(PACKAGE)-dev/usr/share/pwlib/make/ptbuildopts.mak
# for using /usr/share/pwlib as a single PWLIBDIR
ln -s ../../lib debian/$(PACKAGE)-dev/usr/share/pwlib
cp version.h debian/$(PACKAGE)-dev/usr/include/ptlib/
ln -s ../../include/ptlib/version.h debian/$(PACKAGE)-dev/usr/share/pwlib/
ln -s ../../../include/ptbuildopts.h debian/$(PACKAGE)-dev/usr/share/pwlib/include
ln -s ../../../include/ptlib.h debian/$(PACKAGE)-dev/usr/share/pwlib/include
ln -s ../../../include/ptlib debian/$(PACKAGE)-dev/usr/share/pwlib/include
# should not be part of a distribution package:
-rm -f `find debian/$(PACKAGE)-dev/ -name "*.in"`
# plugins
#$(PACKAGE)-plugins-v4l
install -d -m 755 debian/$(PACKAGE)-plugins-v4l/usr/lib/pwlib/$(SHLIBSVER)/device/videoinput/
cp plugins/pwlib/device/videoinput/v4l_pwplugin.so \
debian/$(PACKAGE)-plugins-v4l/usr/lib/pwlib/$(SHLIBSVER)/device/videoinput/
#$(PACKAGE)-plugins-v4l2
install -d -m 755 debian/$(PACKAGE)-plugins-v4l2/usr/lib/pwlib/$(SHLIBSVER)/device/videoinput/
cp plugins/pwlib/device/videoinput/v4l2_pwplugin.so \
debian/$(PACKAGE)-plugins-v4l2/usr/lib/pwlib/$(SHLIBSVER)/device/videoinput/
#$(PACKAGE)-plugins-oss
install -d -m 755 debian/$(PACKAGE)-plugins-oss/usr/lib/pwlib/$(SHLIBSVER)/device/sound/
cp plugins/pwlib/device/sound/oss_pwplugin.so \
debian/$(PACKAGE)-plugins-oss/usr/lib/pwlib/$(SHLIBSVER)/device/sound/
#$(PACKAGE)-plugins-alsa
install -d -m 755 debian/$(PACKAGE)-plugins-alsa/usr/lib/pwlib/$(SHLIBSVER)/device/sound/
cp plugins/pwlib/device/sound/alsa_pwplugin.so \
debian/$(PACKAGE)-plugins-alsa/usr/lib/pwlib/$(SHLIBSVER)/device/sound/
# 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
if [ ! -f ChangeLog ];then \
dh_installchangelogs ;\
else \
dh_installchangelogs ChangeLog; \
fi
# 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
# a new variable will be needed if an epoch is introduced to our versioning
dh_makeshlibs -V '$(PACKAGE) (>= $(UPVERSION)~)'
dh_installdeb
dh_shlibdeps -L $(PACKAGE) -l debian/$(PACKAGE)/usr/lib
dh_gencontrol
dh_md5sums
dh_builddeb
binary-strip:
dh_testdir
dh_testroot
ifneq (4,$(DH_COMPAT))
dh_strip -N$(PACKAGE)-dbg --dbg-package=$(PACKAGE)-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) $(PACKAGE)-plugins-alsa $(PACKAGE)-plugins-oss \
$(PACKAGE)-plugins-v4l $(PACKAGE)-plugins-v4l2 $(PACKAGE)-plugins-avc \
$(PACKAGE)-plugins-dc ; \
do \
cp -af debian/$$pack/usr/lib/debug debian/$(PACKAGE)-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.disabled:
@@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)
@@echo Checking for DFSG-readiness:
@@if ( tar tfvz ../tarballs/$(UPFILENAME)|grep 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
|