root/main/trunk/package-kits/linux/deb/gsdl/Makefile @ 29471

Revision 29471, 2.9 KB (checked in by jts21, 5 years ago)

Added debian package files. Doesn't build to a debian package yet, but there is a Makefile which generates the {main,tools,demo} package contents, which will be used for the debian packaging

Line 
1systemlib   := /usr/lib
2java        := $(systemlib)/jvm/default-java
3systembin   := /usr/bin
4gssrv       := /srv/gsdl
5tomcatlib   := /usr/share/java/tomcat7
6tomcatconf  := /etc/tomcat7/Catalina/localhost
7gstools     := /opt/greenstone
8
9all: cleanpkg main tools demo
10
11svn:
12    @echo "Getting latest source"
13    svn co http://svn.greenstone.org/main/trunk/greenstone3 svn
14
15src: svn
16    $(eval svnver := $(shell cd svn && svnversion -c | grep -o '[[:digit:]:]*'))
17    $(eval srcver := $(shell if test -d src; then cd src && svnversion -c | grep -o '[[:digit:]:]*'; else echo "nope"; fi))
18    if test $(svnver) != $(srcver); then \
19    echo "Making copy of source" ; \
20    rm -rf src ; \
21    cp -rT svn src ; \
22    fi
23
24cleanpkg:
25    @echo Cleaning pkg directory
26    rm -rf pkg
27
28clean: cleanpkg
29    @echo "Cleaning src directory"
30    rm -rf src
31
32cleanall: clean
33    @echo "Cleaning svn directory"
34    rm -rf svn
35
36prepare: src
37    cp -L *.properties *.patch src/
38    cd src ; \
39    export JAVA_HOME=$(java) ; \
40    yes | ant prepare
41    patch -d src/ -p0 -N -i gs2build.patch || :
42    cd src/gs2build/build-src ; \
43    autoconf
44    rm -rf src/packages/*.zip
45    rm -rf src/packages/axis/docs
46    rm -rf src/gs2build/build-src/packages
47
48build: prepare
49    cd src ; \
50    export JAVA_HOME=$(java) ; \
51    ant install
52    mv src/lib/jni/*.jar src/web/WEB-INF/lib/
53    # patch for gs2build tempdir
54    patch -d src/ -p0 -N -i perl-util.patch || :
55    # delete windows/mac stuff
56    find src/ -type d \( -iname "win32" -o -iname "windows" -o -iname "winutil" -o -iname "darwin" \) -exec rm -rf {} \; 2> /dev/null || :
57    find src/ \( -iname "*.dll" -o -iname "*.exe" \) -exec rm -rf {} \; || :
58
59main: build
60    $(eval pkgdir := pkg/main)
61    install -d $(pkgdir)/$(gssrv) $(pkgdir)/$(systemlib) $(pkgdir)/$(tomcatlib)
62    install -dm775 $(pkgdir)/$(tomcatlib)
63    install -Dm755 src/lib/jni/*.so $(pkgdir)/$(systemlib)
64    rsync -av --exclude sites/localsite/collect/ --exclude .svn src/web/ $(pkgdir)/$(gssrv)/
65    install -Dm644 greenstone3.xml $(pkgdir)/$(tomcatconf)/greenstone3.xml
66    mv $(pkgdir)/$(gssrv)/WEB-INF/lib/derby.jar $(pkgdir)/$(tomcatlib)
67
68tools: build
69    $(eval pkgdir := pkg/tools)
70    install -d $(pkgdir)/$(gstools)
71    rsync -av --exclude build-src --exclude common-src --exclude collect/demo --exclude .svn src/gs2build $(pkgdir)/$(gstools)/
72    rsync -av --exclude build-src --exclude common-src --exclude collect/demo --exclude .svn src/bin $(pkgdir)/$(gstools)/
73    install -Dm755 greenstone $(pkgdir)/$(systembin)/greenstone
74
75demo: build
76    $(eval pkgdir := pkg/demo)
77    @echo "Building demo collections"
78    $(shell find sites/localsite/collect/ -mindepth 1 -maxdepth 1 -not -name ".*" -execdir bash -c 'col="$(basename $1)"; import.pl -removeold -site localsite "$$col"; buildcol.pl -removeold -site localsite "$$col"; mv "$$col/building" "$$col/index"' -- {} \;)
79    install -d $(pkgdir)/$(gssrv)/sites/localsite
80    rsync -av --exclude .svn src/web/sites/localsite/collect $(pkgdir)/$(gssrv)/sites/localsite/
81
82.PHONY: svn cleanpkg clean cleanall prepare build main tools demo
Note: See TracBrowser for help on using the browser.