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
|
#!/usr/bin/make -f
# Change this on API breakage
export LIBOPALCOMPAT=2.2
export LIBOPALCOMPAT2=2.1.3
PACKAGE=libopal-$(LIBOPALCOMPAT)
# excludes for the -develop version
STRIP_EXCLUDES = -N$(PACKAGE) -Nlibopal-dbg -Nlibopal-dev -Nsimpleopal
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
MAKE_BUILD_PARAM := OPALDIR=$(CURDIR) PWLIBDIR=/usr/share/pwlib
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 := opal_$(UPVERSION)~dfsg.orig.tar.gz
UPFILENAME := opal_$(UPVERSION).orig.tar.gz
URL := http://www.voxgratia.org/releases/opal-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) --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
touch autotools
check-ilbc:
if [ -d src/codec/iLBC ];then \
echo "ERROR: iLBC code must be removed from upstream sources" ; false ; \
fi
touch $@
build-arch-stamp: config.status
# put NOTRACE to empty to build with PTRACING code
$(MAKE) $(MAKE_BUILD_PARAM) CFLAGS="$(CFLAGS)" DEBUG= NOTRACE= P_SHAREDLIB=1 OBJDIR_SUFFIX=r OPAL_LIBDIR=$(CURDIR)/lib/opt optshared
$(MAKE) $(MAKE_BUILD_PARAM) CFLAGS="$(CFLAGS)" DEBUG= NOTRACE= P_SHAREDLIB=0 OBJDIR_SUFFIX=r OPAL_LIBDIR=$(CURDIR)/lib/opt optnoshared
$(MAKE) $(MAKE_BUILD_PARAM) CFLAGS="$(CFLAGS)" DEBUG=1 NOTRACE= P_SHAREDLIB=1 OBJDIR_SUFFIX=d OPAL_LIBDIR=$(CURDIR)/lib/debug debugshared
$(MAKE) $(MAKE_BUILD_PARAM) CFLAGS="$(CFLAGS)" DEBUG=1 NOTRACE= P_SHAREDLIB=0 OBJDIR_SUFFIX=d OPAL_LIBDIR=$(CURDIR)/lib/debug debugnoshared
# ensure we do a fresh check with hello world.
# ...first static
$(MAKE) $(MAKE_BUILD_PARAM) -C samples/simple clean
$(RM) -rf samples/simple/obj_*
# put NOTRACE to empty to build with PTRACING code
$(MAKE) $(MAKE_BUILD_PARAM) CFLAGS="$(CFLAGS)" DEBUG= NOTRACE= P_SHAREDLIB=0 OBJDIR_SUFFIX=r OPAL_LIBDIR=$(CURDIR)/lib/opt -C samples/simple optnoshared
$(MAKE) $(MAKE_BUILD_PARAM) CFLAGS="$(CFLAGS)" DEBUG=1 NOTRACE= P_SHAREDLIB=0 OBJDIR_SUFFIX=d OPAL_LIBDIR=$(CURDIR)/lib/debug -C samples/simple debugnoshared
samples/simple/obj_*_r/simpleopal --help >/dev/null
samples/simple/obj_*_d/simpleopal --help >/dev/null
## then shared...
$(MAKE) $(MAKE_BUILD_PARAM) -C samples/simple clean
$(RM) -rf samples/simple/obj_*
$(MAKE) $(MAKE_BUILD_PARAM) CFLAGS="$(CFLAGS)" DEBUG= NOTRACE= P_SHAREDLIB=1 OBJDIR_SUFFIX=r OPAL_LIBDIR=$(CURDIR)/lib/opt -C samples/simple optshared
$(MAKE) $(MAKE_BUILD_PARAM) CFLAGS="$(CFLAGS)" DEBUG=1 NOTRACE= P_SHAREDLIB=1 OBJDIR_SUFFIX=d OPAL_LIBDIR=$(CURDIR)/lib/debug -C samples/simple debugshared
if (samples/simple/obj_*_d/simpleopal --help >/dev/null);then \
echo shared debug simpleopal incorrectly compiled static; false;\
else \
echo shared debug simpleopal correctly compiled non-static; \
fi
LD_LIBRARY_PATH=$(CURDIR)/lib/debug samples/simple/obj_*_d/simpleopal --help >/dev/null
if (samples/simple/obj_*_r/simpleopal --help >/dev/null);then \
echo shared opt simpleopal incorrectly compiled static; false;\
else \
echo shared opt simpleopal correctly compiled non-static; \
fi
LD_LIBRARY_PATH=$(CURDIR)/lib/opt samples/simple/obj_*_r/simpleopal --help >/dev/null
#$(MAKE) $(MAKE_BUILD_PARAM) -C samples/simple clean
#$(RM) -rf samples/simple/obj_*
touch build-arch-stamp
build-indep: build-indep-stamp
build-indep-stamp: config.status
$(MAKE) $(MAKE_BUILD_PARAM) docs
touch build-indep-stamp
clean: check-ilbc clean-patched unpatch
clean-patched:
dh_testdir
dh_testroot
rm -f build-arch-stamp build-indep-stamp patch-stamp check-ilbc
rm -f config.status config.log autotools
if [ -f Makefile ];then \
$(MAKE) $(MAKE_BUILD_PARAM) optclean debugclean clean;\
$(MAKE) $(MAKE_BUILD_PARAM) -C samples/simple clean;\
fi
rm -rf samples/simple/obj*
rm -f opal_inc.mak include/opal/buildopts.h
rm -rf lib
rm -f src/speex/libspeex/Makefile
rm -rf html
rm -f `find . -name "*~"`
rm -rf `find debian/* -type d -name libopal-*` debian/files* core
rm -rf debian/simpleopal/
rm -f debian/*substvars
rm -f debian/*.debhelper
rm -f debian/libopal-*.*.docs
rm -f config.status
dh_clean
install: install-arch install-indep
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 \
$(CURDIR)/debian/$(PACKAGE)-develop/usr/lib
install -m 755 lib/opt/libopal.so.*.*.* $(CURDIR)/debian/$(PACKAGE)/usr/lib
install -m 755 lib/debug/libopal.so.*.*.* $(CURDIR)/debian/$(PACKAGE)-develop/usr/lib
#$(MAKE) $(MAKE_BUILD_PARAM) CFLAGS="$(CFLAGS)" DEBUG= NOTRACE= P_SHAREDLIB=1 OBJDIR_SUFFIX=r OPAL_LIBDIR=$(CURDIR)/lib/opt DESTDIR=$(CURDIR)/debian/$(PACKAGE) -C plugins install
#$(MAKE) $(MAKE_BUILD_PARAM) CFLAGS="$(CFLAGS)" DEBUG=1 NOTRACE= P_SHAREDLIB=1 OBJDIR_SUFFIX=d OPAL_LIBDIR=$(CURDIR)/lib/debug DESTDIR=$(CURDIR)/debian/$(PACKAGE)-develop -C plugins install
#for suffix in "" "-develop";do \
# mv $(CURDIR)/debian/$(PACKAGE)$$suffix/usr/lib/pwlib $(CURDIR)/debian/$(PACKAGE)$$suffix/usr/lib/opal-$(SHLIBSVER) ;\
# mv $(CURDIR)/debian/$(PACKAGE)$$suffix/usr/lib/opal-$(SHLIBSVER) $(CURDIR)/debian/$(PACKAGE)$$suffix/usr/lib/pwlib/opal-$(SHLIBSVER) ;\
#done
ifneq ($(SHLIBSVER),$(LIBOPALCOMPAT))
for suffix in "" "-develop";do \
ln -s libopal.so.$(SHLIBSVER) \
debian/$(PACKAGE)$$suffix/usr/lib/libopal.so.$(LIBOPALCOMPAT); \
done
endif
ifneq ($(SHLIBSVER),$(LIBOPALCOMPAT2))
for suffix in "" "-develop";do \
ln -s libopal.so.$(SHLIBSVER) \
debian/$(PACKAGE)$$suffix/usr/lib/libopal.so.$(LIBOPALCOMPAT2); \
done
endif
# simpleopal
$(MAKE) $(MAKE_BUILD_PARAM) CFLAGS="$(CFLAGS)" DEBUG= P_SHAREDLIB=1 OBJDIR_SUFFIX=r OPAL_LIBDIR=$(CURDIR)/lib/opt INSTALL_DIR=$(CURDIR)/debian/simpleopal/usr -C samples/simple install
# clean simple to install it as a sample in the docs
$(MAKE) $(MAKE_BUILD_PARAM) -C samples/simple clean
$(RM) -rf samples/simple/obj_*
# libopal-dev package
cp -v lib/opt/libopal_s.a debian/libopal-dev/usr/lib/
cp -v lib/debug/libopal_s.a debian/libopal-dev/usr/lib/libopal_d_s.a
ln -s libopal.so.$(SHLIBSVER) debian/libopal-dev/usr/lib/libopal.so
sed -e 's#^OPALDIR.*#OPALDIR = \/usr\/lib\/opal#g' \
opal_inc.mak > debian/libopal-dev/usr/share/opal/opal_inc.mak
cp -vr include/* debian/libopal-dev/usr/include/opal
find debian/libopal-dev/usr/include -type f -exec chmod 644 {} \;
cp version.h debian/libopal-dev/usr/include/opal/
# linking stuff under usr/share/opal
ln -s ../../include/opal/version.h debian/libopal-dev/usr/share/opal/
ln -s ../../include/opal debian/libopal-dev/usr/share/opal/include
ln -s ../../lib debian/libopal-dev/usr/share/opal/
# 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_installexamples
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
# a new variable will be needed if an epoch is introduced to our versioning
dh_makeshlibs -V '$(PACKAGE) (>= $(UPVERSION)~) | $(PACKAGE)-develop (>= $(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 -Nlibopal-dbg -N$(PACKAGE)-develop --dbg-package=libopal-dbg
# can't ship those in libopal-dbg due to namespace overlap
dh_strip -p$(PACKAGE)-develop $(STRIP_EXCLUDES) --dbg-package=$(PACKAGE)-develop
else
# As dh_strip does not work fine for multiple binary package
# we need to workaround that manually
dh_strip --exclude=libopal_d --keep-debug
for pack in $(PACKAGE) simpleopal ; do \
cp -af debian/$$pack/usr/lib/debug debian/libopal-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
@@echo Downloading $(UPFILENAME) from $(URL) ...
@@wget -N -nv -T10 -t3 -O ../tarballs/$(UPFILENAME) $(URL)
@@echo 'Repacking as DFSG-free (removing iLBC)...'
@@mkdir -p ../tarballs/opal-$(UPVERSION).tmp/
@@cd ../tarballs/opal-$(UPVERSION).tmp ; \
tar xfz ../$(UPFILENAME)
@@rm -rf ../tarballs/opal-$(UPVERSION).tmp/opal*/src/codec/iLBC \
../tarballs/opal-$(UPVERSION).tmp/opal*/include/codec/ilbccodec.h
@@echo Writing archive ../tarballs/$(FILENAME) ...
@@cd ../tarballs/opal-$(UPVERSION).tmp ; \
tar cfz ../$(FILENAME) *
@@echo Cleaning up...
@@$(RM) -rf ../tarballs/opal-$(UPVERSION).tmp/ ../tarballs/$(UPFILENAME)
binary: binary-arch binary-indep
.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch clean-patched
|