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
|
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# This is the debhelper compatability version to use.
export DH_COMPAT=3
CWD=$(shell pwd)
DESTDIR=debian/python$(PVER)-4suite
COMMONPKGDIR=debian/python-4suite-common
DOCDESTDIR=debian/python-4suite-doc
DOCDIR=/usr/share/doc/python-4suite-doc
EXAMPLESDIR=$(DOCDIR)/examples
POSTFIX=.python$(PVER)-4suite
BINAPPS=4rdf 4ss 4versa 4xml 4xpath 4xslt 4xupdate 4ss_manager
SHAREAPPS=4ssd
ARCHIVE=$(shell ls -1 4Suite-*.tar.bz2)
SRCDIR=4Suite
PYTHON_VERSIONS=2.4 2.3 2.2
export XML_CATALOGS=$(CWD)/$(SRCDIR)/build/share/default.cat
export XML_DEBUG_CATALOG=1
export PYTHONPATH=""
#DPATCH_WORKDIR=$(SRCDIR)
include /usr/share/dpatch/dpatch.make
$(SRCDIR): $(ARCHIVE)
tar -xjf $^
test -d $(SRCDIR)
for dir in `find $@ -name "CVS"`; do rm -rf "$$dir" >/dev/null 2>&1; done
: # Make sure only the Debian version of expat is used
rm -rf "$(SRCDIR)/Ft/Xml/src/expat"
: # Replace all '#!' calls to python with python$(PVER)
cd $(SRCDIR) && \
for i in `find -type f`; do \
if head -1 "$$i" | grep -q '^#[[:space:]]*!.*python'; then \
sed 's@^#[[:space:]]*!.*python.*@#!/usr/bin/env python@' "$$i" > "$$i.temp"; \
chown --reference="$$i" "$$i.temp"; \
chmod --reference="$$i" "$$i.temp"; \
chmod a+x "$$i.temp"; \
mv -f "$$i.temp" "$$i"; \
fi \
done
build: $(SRCDIR) patch build-stamp
build-stamp:
dh_testdir
: # Fix file attributes
test -f $(SRCDIR)/Ft/Server/Server/4SuiteRepository.owl && chmod a-x $(SRCDIR)/Ft/Server/Server/4SuiteRepository.owl || true
: # We have not to do some tweaks to get `bdist_install' working without
: # errors. bdist_install's procedure looking for the *.cat files in the
: # DATADIR (see build/lib.linux-*-$(PVER)/Ft/__config__.py after `build').
: # If the *.cat files are not there exceptions are thrown so we try to
: # create a work-arround here so `bdist_install' works temporary.
mkdir -p "$(SRCDIR)/build/share" && \
ln -s ../../build/share $(SRCDIR)/Ft/Xml/Schemata && \
cd "$(SRCDIR)/build/share" && \
ln -s "." "Schemata" && \
for fname in `find ../.. -name "*.dtd" -or -name "*.cat"`; do \
ln -fs "$$fname"; \
done
# Build the package for Python
for pver in $(PYTHON_VERSIONS); do \
$(MAKE) -f debian/rules PVER=$$pver build-python || exit 1; \
done
# Build the documentation
#/usr/bin/docbook-to-man debian/python-4suite.sgml > python-4suite.1
touch build-stamp
build-python: build-python$(PVER)-stamp
build-python$(PVER)-stamp:
@echo "cd $(SRCDIR) && python$(PVER) setup.py config --system --docdir=\"$(DOCDIR)\" --datadir=\"$(CWD)/$(SRCDIR)/build/share\"" >build-python$(PVER)-log
cd $(SRCDIR) && python$(PVER) setup.py config --system --docdir="$(DOCDIR)" --datadir="$(CWD)/$(SRCDIR)/build/share" >>../build-python$(PVER)-log 2>&1
@echo "cd $(SRCDIR) && python$(PVER) setup.py -v build $(if $(findstring $(strip $(PVER)),2.4),--with-docs,)" >>build-python$(PVER)-log
cd $(SRCDIR) && python$(PVER) setup.py -v build $(if $(findstring $(strip $(PVER)),2.4),--with-docs,) >>../build-python$(PVER)-log 2>&1
@if grep -q "^Traceback " "build-python$(PVER)-log"; then cat "build-python$(PVER)-log"; exit 1; else true; fi
: # Instead of maintaining Debian files for each Python version we create them
: # at runtime using template files. @PVER@ will be replaced in those files by
: # Python's version we proceeding.
for template in debian/*PVER-4suite.*; do \
dname=`echo $$template | sed -e "s/PVER/$(PVER)/g;s/BINAPPS/$(BINAPPS)/g;s/SHAREAPPS/$(SHAREAPPS)/g"`; \
sed -e "s/@PVER@/$(PVER)/g;s/@BINAPPS@/\"$(BINAPPS)\"/g;s/@SHAREAPPS@/\"$(SHAREAPPS)\"/g" "$$template" > "$$dname"; \
done
touch $@
clean: clean-patched unpatch
clean-patched:
dh_testdir
rm -f *-stamp config.cache build-*-log install-*-log
# Clean the Python build
rm -rf $(SRCDIR) debian/patched
for ver in $(PYTHON_VERSIONS); do \
for fname in debian/pythonPVER-4suite*; do \
rm -f `echo $$fname | sed -e "s/PVER/$$ver/g"`; \
done; \
done
dh_clean
clean-python:
rm -f debian/python$(PVER)-4suite.*
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
for pver in $(PYTHON_VERSIONS); do \
$(MAKE) -f debian/rules PVER=$$pver install-python || exit 1; \
done
cp debian/etc_default_4ss $(CURDIR)/debian/python-4suite-server/etc/default/4ss
cp debian/etc_logrotate.d_4ss $(CURDIR)/debian/python-4suite-server/etc/logrotate.d/4ss
install-python: install-python$(PVER)-stamp
install-python$(PVER)-stamp: build-python$(PVER)-stamp
: # Revert --datadir setting to the true directory where 4Suite's read-only architecture
: # independend files will be stored.
for fname in $(SRCDIR)/build/lib.*-$(PVER)/Ft/__config__.py $(SRCDIR)/config.cache; do \
sed -e "s@\(DATADIR.*=\).*@\1 '/usr/share/4Suite'@g;s@\(datadir.*=\).*@\1 /usr/share/4Suite@g" "$$fname" >"$${fname}.temp" && \
chown --reference="$$fname" "$${fname}.temp"; \
chmod --reference="$$fname" "$${fname}.temp"; \
mv -f "$${fname}.temp" "$$fname"; \
done
: ## Install the package for Python (it takes long) #######################
@echo "cd $(SRCDIR) && python$(PVER) setup.py -v bdist_install --root=\"$(CWD)/$(DESTDIR)\"" >install-python$(PVER)-log
cd $(SRCDIR) && python$(PVER) setup.py -v bdist_install --root="$(CWD)/$(DESTDIR)" >>../install-python$(PVER)-log 2>&1
@if grep -q "^Traceback " "install-python$(PVER)-log"; then cat "install-python$(PVER)-log"; exit 1; else true; fi
find $(DESTDIR) -name '*.py[co]' -exec rm -f "{}" \;
: # Move the documentation of 4Suite
test -d "$(DOCDESTDIR)$(DOCDIR)" || dh_movefiles -ppython-4suite-doc --sourcedir="$(DESTDIR)" "$(DOCDIR)"
rm -rf "$(DESTDIR)$(DOCDIR)"
: # Move tests to documentation's example sub-directory.
mkdir -p "$(DOCDESTDIR)/$(EXAMPLESDIR)"
test -d "$(DOCDESTDIR)/$(EXAMPLESDIR)/tests" || mv "$(DESTDIR)/usr/lib/4Suite/tests" "$(DOCDESTDIR)/$(EXAMPLESDIR)"
rm -rf "$(DESTDIR)/usr/lib/4Suite"
: # Replace all '#!' calls to python with python$(PVER)
cd $(DESTDIR) && \
for i in `find -type f`; do \
if head -1 "$$i" | grep -q '^#[[:space:]]*!.*python'; then \
sed 's@^#[[:space:]]*!.*python.*@#!/usr/bin/env python$(PVER)@' "$$i"> "$$i.temp"; \
chown --reference="$$i" "$$i.temp"; \
chmod --reference="$$i" "$$i.temp"; \
chmod a+x "$$i.temp"; \
mv -f "$$i.temp" "$$i"; \
fi \
done
: # Move arround common used files and directories.
for i in "etc" "var" "usr/share/4Suite"; do \
test -d $(COMMONPKGDIR)/$$i || dh_movefiles -ppython-4suite-common --sourcedir="$(DESTDIR)" $$i; \
rm -rf $(DESTDIR)/$$i; \
done
: # Move 4ssd to /usr/share/4Suite directory to compliance the FHS. 4ssd is not stand-alone executable.
: # 4ss_manager have to be used instead.
if [ -f $(DESTDIR)/usr/bin/4ssd ]; then \
mkdir -p $(DESTDIR)/usr/share/4Suite; \
mv $(DESTDIR)/usr/bin/4ssd $(DESTDIR)/usr/share/4Suite/4ssd$(POSTFIX); \
fi
: # Rename scripts to their alternatives name
for i in $(DESTDIR)/usr/bin/*; do \
mv $$i $$i$(POSTFIX); \
done
: # Install lintian overrides
cd debian && \
test -d python$(PVER)-4suite && \
mkdir -p python$(PVER)-4suite/usr/share/lintian/overrides && \
cp python$(PVER)-4suite.overrides python$(PVER)-4suite/usr/share/lintian/overrides/python$(PVER)-4suite
touch $@
# Build architecture-independent files here.
binary-indep: build install
dh_testdir -i
dh_testroot -i
# dh_installdebconf -i
dh_installdocs -i
test -f debian/python-4suite-doc/usr/share/doc/python-4suite-doc/html/index.html
dh_installexamples -i
# dh_installmenu -i
# dh_installemacsen -i
# dh_installpam -i
dh_installinit -i --init-script=4ss
# dh_installcron -i
# dh_installmanpages -i
# dh_installinfo -i
dh_installchangelogs -i
dh_link -i
dh_strip -i
dh_compress -i -Npython-4suite-doc
dh_compress -i -ppython-4suite-doc -X.xml -X.doc
dh_fixperms -i
# dh_suidregister
# dh_makeshlibs
dh_installdeb -i
# dh_perl
dh_shlibdeps -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_installdebconf -a
dh_installdocs -a
dh_installexamples -a
# dh_installmenu -a
# dh_installemacsen -a
# dh_installpam -a
dh_installinit -a --init-script=4ss
# dh_installcron
# dh_installmanpages
# dh_installinfo
dh_installchangelogs -a
dh_link -a
dh_strip -a
dh_compress -a
dh_fixperms -a
# dh_suidregister
# dh_makeshlibs
dh_installdeb -a
# dh_perl
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
|