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 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392
|
#!/usr/bin/make -f
# debian/rules for sqlrelay
# This file is public domain software
# Florian M. Weps <fweps@greenmail.ch>
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
d=debian/tmp
pkg=sqlrelay
v=0.37
libpkg=libsqlrelay-$(v)
pkgdoc=$(pkg)-doc
pkgdev=$(pkg)-dev
pkgtest=$(pkg)-test
zda=zope-sqlrelayda
perlapi=libfirstworks-sqlr-perl
perldbdapi=libdbd-sqlrelay-perl
javaapi=libsqlrelay-java
tclapi=libsqlrelay-tcl
rubyapi=libsqlrelay-ruby
php5api=php5-sqlrelay
phpapiver=$(shell php-config5 --phpapi)
DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
with_java = yes
java_conf_args = --with-java-prefix=/usr/lib/jvm/java-gcj
#ifneq (,$(filter $(DEB_BUILD_ARCH), arm m68k hppa mips mipsel))
ifneq (,$(filter $(DEB_BUILD_ARCH), arm m68k mips mipsel))
with_java = no
java_conf_args = --without-java
export DH_OPTIONS=-Nlibsqlrelay-java
endif
FILES_TO_CLEAN=src/api/perl/SQLRConnection/Makefile.PL \
src/api/perl/SQLRCursor/Makefile.PL
# this is the version zope uses?
PYTHONVERSION=$(shell python -c 'import sys; print sys.version[:3]')
#PYTHONVERSION=2.3
PYTHONPATH=/usr/lib/python$(PYTHONVERSION)
NODOCS="python-$(pkg)" \
"python-$(pkg)" \
"$(perlapi)" \
"$(zda)" \
"$(rubyapi)" \
"$(php5api)" \
"$(tclapi)" \
"$(pkgdev)" \
"$(pkg)-freetds" \
"$(pkg)-postgresql" \
"$(pkg)-odbc" \
"$(pkg)-mdb" \
"$(pkg)-sqlite" \
"$(pkg)-mysql"
ifeq ($(with_java),yes)
NODOCS+="$(javaapi)"
endif
NODOCS2= \
"$(pkgtest)" \
"$(pkg)-config-gtk" \
CONNECTIONMANPAGES="$(pkg)-freetds" \
"$(pkg)-postgresql" \
"$(pkg)-odbc" \
"$(pkg)-sqlite" \
"$(pkg)-mysql"
configure: configure-stamp
configure-stamp: patch-stamp
dh_testdir
# autoconf ./configure.in > configure 2> /dev/null
# chmod 755 ./configure
cp -p /usr/share/misc/config.* .
./configure \
--prefix=/usr/share \
--exec-prefix=/usr \
--includedir=/usr/include \
--sysconfdir=/etc/$(pkg) \
--localstatedir=/var/cache \
--with-python-version=$(PYTHONVERSION) \
--with-zope-prefix=/usr/lib/zope \
--with-perl-install-prefix=/usr/lib/perl5 \
--with-ruby-prefix=/usr \
$(java_conf_args) \
--disable-python-rpath \
--disable-php-rpath \
--disable-tcl-rpath \
--disable-perl-rpath \
--disable-psql-rpath
# --enable-zope \
# sed -e "s? -L/usr/lib ? ?" -e "s? -Wl,-rpath /usr/lib??" \
# config.mk > config.mk.new; mv config.mk.new config.mk
: # zope detection is messed up ...
sed -e 's,^HAVE_ZOPE.*=.*,HAVE_ZOPE = yes,' \
-e 's,^ZOPEDIR.*=.*,ZOPEDIR = /usr/lib/zope/lib/python,' \
config.mk > config.mk.new; mv config.mk.new config.mk
cp -p config.mk config.mk.save
touch configure-stamp
build: build-stamp
build-stamp: configure-stamp
dh_testdir
$(MAKE)
touch build-stamp
clean:
dh_testdir
dh_testroot
rm -f configure-stamp build-stamp
rm -f config.mk.save
-$(MAKE) unconfig
rm -f config.guess config.sub
-find -name '.libs' -type d | xargs rm -rf
debian/rules unpatch
rm -f debian/shlibs.local
dh_clean
install:
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
-if [ -f config.mk.save ]; then \
cp -p config.mk.save config.mk; \
fi
$(MAKE) \
DESTDIR=`pwd`/debian/tmp \
prefix=`pwd`/debian/tmp/usr/share \
exec_prefix=`pwd`/debian/tmp/usr \
includedir=`pwd`/debian/tmp/usr/include \
libdir=`pwd`/debian/tmp/usr/lib \
bindir=`pwd`/debian/tmp/usr/bin \
localstatedir=`pwd`/debian/tmp/var/cache \
mandir=`pwd`/debian/tmp/usr/share/man \
docdir=`pwd`/debian/tmp/usr/share/doc/sqlrelay/html \
sysconfdir=`pwd`/debian/tmp/etc/$(pkg) \
install
: # work around wrong perl installation locations
mkdir -p $(d)/usr/lib/perl5 $(d)/usr/share/perl5
eval $(shell perl -V:sitelib) \
mv $(d)/$$sitelib/DBD $(d)/usr/share/perl5
# hmm, 0.35 installs these in sitearch, not sitelib ...
eval $(shell perl -V:sitearch) \
mv $(d)/$$sitearch/SQLRelay $(d)/usr/share/perl5
eval $(shell perl -V:sitearch) \
mv $(d)/$$sitearch/auto $(d)/usr/lib/perl5
# mv $(d)/$$sitearch/Firstworks $(d)/usr/lib/perl5
: # if $(perlapi) and $(perldbdapi) are built we need
: # to clean up .packlist files
-find $(d)/usr/lib -type f -name .packlist | xargs rm -f
: # work around wrong ruby installation locations
mkdir -p $(d)/usr/lib/ruby
mv $(d)/usr/local/lib/site_ruby/1.8 $(d)/usr/lib/ruby
: # work around wrong zope installation locations
mkdir -p $(d)/usr/share/zope/Products
mv $(d)/usr/lib/zope/lib/python/ZSQLRelayDA \
$(d)/usr/share/zope/Products/
rm -rf $(d)/usr/share/zope/Products/ZSQLRelayDA/SQLRelay
# : # ugly hack for python2.4 extension
# sed -e 's/python2.3/python2.4/g' config.mk.save > config.mk
# $(MAKE) -C src/api/python rebuild
# $(MAKE) -C src/api/python DESTDIR=`pwd`/debian/tmp \
# install
-find debian/tmp -name '*.so*' -type f \
| xargs chrpath --keepgoing --delete
ifeq ($(with_java),yes)
: # $(javaapi)
mkdir -p debian/$(javaapi)/usr/share/java debian/$(javaapi)/usr/lib/java
mv $(d)/usr/java/*.jar debian/$(javaapi)/usr/share/java/
mv $(d)/usr/java/com debian/$(javaapi)/usr/lib/java/
endif
# only shared object files needed
rm -f $(d)/usr/lib/libmysql*sqlrelay.*
dh_install --sourcedir=debian/tmp --list-missing
: # $(pkg)
cp -a debian/sqlrshrc debian/$(pkg)/etc/$(pkg)
cp -a debian/instances debian/$(pkg)/etc/$(pkg)
mv debian/$(pkg)/etc/$(pkg)/$(pkg).conf.example \
debian/$(pkg)/etc/$(pkg)/$(pkg).conf
chown root:root debian/$(pkg)/etc/$(pkg)/$(pkg).conf
chmod 600 debian/$(pkg)/etc/$(pkg)/$(pkg).conf
mkdir -p debian/$(pkg)/usr/sbin
cp -a debian/sqlr-ipclean debian/$(pkg)/usr/bin
chmod 755 debian/$(pkg)/usr/bin/sqlr-ipclean
chmod 1777 debian/$(pkg)/var/cache/sqlrelay/tmp
: # $(pkg)-dev
sed -i -e 's/$${DESTDIR}//g' debian/sqlrelay-dev/usr/lib/pkgconfig/sqlrelay-c*.pc
: # $(pkg)-doc
if [ ! -s debian/$(pkgdoc)/usr/share/doc/sqlrelay/html/api/java/package-list ] ; then \
rm debian/$(pkgdoc)/usr/share/doc/sqlrelay/html/api/java/package-list ; \
fi
: # install Testfiles
mkdir -p debian/$(pkgtest)/usr/share/doc/$(pkg)/examples
cp -a test/* debian/$(pkgtest)/usr/share/doc/$(pkg)/examples
-chmod 644 debian/$(pkgtest)/usr/share/doc/$(pkg)/examples/*/clean
-chmod 644 debian/$(pkgtest)/usr/share/doc/$(pkg)/examples/*/compile
-find debian/$(pkgtest) -name '*.php' | xargs chmod 644
: # python-$(pkg)
mkdir -p debian/python-$(pkg)/usr/share/man/man1
chmod 755 debian/python-$(pkg)/usr/lib/python*/site-packages/SQLRelay/PySQLRDB.py
: # Replace all '#!' calls to python with /usr/bin/python
: # and make them executable
for i in `find debian -mindepth 3 -type f`; do \
sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python\1,' \
$$i > $$i.temp; \
if cmp --quiet $$i $$i.temp; then \
rm -f $$i.temp; \
else \
mv -f $$i.temp $$i; \
chmod 755 $$i; \
echo "fixed interpreter: $$i"; \
fi; \
done
: # $(zda)
chmod 644 debian/$(zda)/usr/share/zope/Products/ZSQLRelayDA/icons/*
chmod 644 debian/$(zda)/usr/share/zope/Products/ZSQLRelayDA/DABase.py
( echo "Name: ZSQLRelayDA"; echo "Package: $(zda)" ) \
> debian/$(zda).dzproduct
# cp -p debian/$(zda).dzproduct \
# debian/$(zda)/usr/share/zope/Products/ZSQLRelayDA/.dzproduct
dh_installzope -p$(zda)
: # $(rubyapi)
: # $(pkg)-config-gtk
mkdir -p debian/$(pkg)-config-gtk/usr/share/man/man1
mv debian/$(pkg)/usr/share/man/man1/sqlr-config-gtk.1 \
debian/$(pkg)-config-gtk/usr/share/man/man1
# mkdir -p debian/$(pkg)-config-gtk/usr/lib/menu
# cp debian/menu debian/$(pkg)-config-gtk/usr/lib/menu/$(pkg)-config-gtk
: # set links for the connection manpages
for con in $(CONNECTIONMANPAGES) ; do \
mkdir -p debian/$${con}/usr/share/man/man8 ; \
ln -s sqlr-connection.8.gz debian/$${con}/usr/share/man/man8/sqlr-connection-`echo $${con} | sed "s/$(pkg)-//"`.8.gz ; \
ln -s sqlr-connection.8.gz debian/$${con}/usr/share/man/man8/sqlr-connection-`echo $${con} | sed "s/$(pkg)-//"`-debug.8.gz ; \
done
ln -s sqlr-listener.8.gz \
debian/$(pkg)/usr/share/man/man8/sqlr-listener-debug.8.gz
: # remove CVS dirs
-find debian -name CVS -type d | xargs rm -rf
: # remove empty dirs
for d in `find debian -depth -type d -empty 2> /dev/null`; do \
while rmdir $$d 2> /dev/null; do d=`dirname $$d`; done; \
done
# Build architecture-independent files here.
binary-indep: build install
dh_testdir -i
dh_testroot -i
dh_installdocs -i
dh_installexamples -i
dh_installmenu -i
dh_installcron -i
dh_installman -i
dh_installinfo -i
dh_installchangelogs -i
for nodoc in $(perldbdapi) ; do \
rm -rf `pwd`/debian/$${nodoc}/usr/share/doc/$${nodoc} ; \
ln -s $(perlapi) `pwd`/debian/$${nodoc}/usr/share/doc/$${nodoc} ; \
done
for nodoc in $(zda) ; do \
rm -rf `pwd`/debian/$${nodoc}/usr/share/doc/$${nodoc} ; \
ln -s python-sqlrelay `pwd`/debian/$${nodoc}/usr/share/doc/$${nodoc} ; \
done
dh_link -i
dh_compress -i
dh_fixperms -i
dh_perl -i
dh_pycentral -i
dh_python -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir -a
dh_testroot -a
dh_installdocs -a AUTHORS NEWS README TODO ChangeLog
dh_installexamples -a
dh_installmenu -a
# dh_installlogrotate -a
# dh_installpam -a
# dh_installmime -a
dh_installinit -a
dh_installcron -a
dh_installman -a
rm -rf debian/$(pkg)/usr/share/man/man3
dh_installinfo -a
dh_installchangelogs -a ChangeLog
for nodoc in $(NODOCS) ; do \
rm -rf `pwd`/debian/$${nodoc}/usr/share/doc/$${nodoc} ; \
ln -s $(libpkg) `pwd`/debian/$${nodoc}/usr/share/doc/$${nodoc} ; \
done
for nodoc in $(NODOCS2) ; do \
rm -rf `pwd`/debian/$${nodoc}/usr/share/doc/$${nodoc} ; \
ln -s $(pkg) `pwd`/debian/$${nodoc}/usr/share/doc/$${nodoc} ; \
done
dh_strip -a
dh_link -a
dh_compress -a -X.php
dh_fixperms -a
dh_perl -a
dh_pycentral -a
dh_python -a
dh_makeshlibs -psqlrelay-postgresql -psqlrelay-mysql -p$(libpkg)
sed 's/$$/ (= \$${Source-Version})/' debian/*/DEBIAN/shlibs \
> debian/shlibs.local
dh_installdeb -a
dh_shlibdeps -a -N$(libpkg)
rm -f debian/shlibs.local
dh_shlibdeps -p$(libpkg)
echo "php:Depends=phpapi-$(phpapiver)" >> debian/php5-sqlrelay.substvars
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
binary: binary-indep binary-arch
patchdir = debian/patches
# which patches should be applied?
debian_patches = \
amd64-configure \
patch: patch-stamp
patch-stamp: $(foreach p,$(debian_patches),patch-stamp-$(p))
echo ""; echo "Patches applied in this version:" > pxxx
for i in $(debian_patches); do \
echo "" >> pxxx; echo "$$i:" >> pxxx; \
sed -n 's/^# *DP: */ /p' $(patchdir)/$$i.dpatch >> pxxx; \
done
mv -f pxxx $@
reverse-patches: unpatch
unpatch:
for stamp in none `ls -1t patch-stamp-* 2>/dev/null`; do \
case "$$stamp" in none|patched-stamp|patched-\*) continue; esac; \
patch=`echo $$stamp | sed -e 's,patch-stamp-,,'`; \
echo "trying to revert patch $$patch ..."; \
if [ -x $(patchdir)/$$patch.dpatch ]; then true; else \
chmod +x $(patchdir)/$$patch.dpatch; fi; \
if $(patchdir)/$$patch.dpatch -unpatch; then \
echo "reverted $$patch patch."; \
rm -f $$stamp; \
else \
echo "error in reverting $$patch patch."; \
exit 1; \
fi; \
done
rm -f patch-stamp
patch-stamp-%: $(patchdir)/%.dpatch
if [ -x $< ]; then true; else chmod +x $<; fi
if [ -f $@ ]; then \
echo "$* patches already applied."; exit 1; \
fi
$< -patch
echo "$* patches applied." > $@
.PHONY: build clean binary-indep binary-arch binary install
|