source: extensions/jiwigo/trunk/install/create_executables.sh @ 9890

Last change on this file since 9890 was 9890, checked in by mlg, 13 years ago

Updates build script

File size: 3.5 KB
Line 
1#!/bin/bash
2## this script generates executables for jiwigo
3## to use it, you have to download the "work" directory
4## here : http://www.jiwigo.com/downloads/work.tar.gz
5## you just have to change work_path to indicate the path to "work"
6## and "project_path" to the path of the project.
7## you have to run the mvn jar command before launching this script
8## the mvn command is writter in the install file of the project : install/install.txt
9## all the generated files will be moved to the "generation" directory.
10## the package dpkg-dev must be installed
11work_path='/home/mael/Documents/jiwigo/work'
12project_path='/home/mael/workspace/jiwigo'
13target_path=$project_path/target
14
15
16
17###############################################################################################
18#####################           building deb                     ##############################
19###############################################################################################
20
21
22echo '#####         building deb...         #####'
23cd $work_path
24
25
26#Calculate size and version to complete debian's control file
27size=`du -cs jiwigo`
28size=`echo $size | cut -d ' ' -f 1`
29version=`find $target_path -type f -name \*with-dependencies.jar | xargs -I file echo file | cut -d '-' -f 2`
30cp $work_path/templates/control_template $work_path/temp
31echo Version: $version >> $work_path/temp
32echo Installed-Size: $size >> $work_path/temp
33rm $work_path/jiwigo/DEBIAN/control
34mv temp $work_path/jiwigo/DEBIAN/control
35
36#copies sources
37rm -rf $work_path/jiwigo/usr/share/jiwigo/src/src-jiwigo/*
38cp -r $project_path/src/* $work_path/jiwigo/usr/share/jiwigo/src/src-jiwigo/
39
40#copies the jar
41rm $work_path/jiwigo/usr/share/jiwigo/jiwigo.jar
42find $target_path -type f -name \*with-dependencies.jar -exec cp {} $work_path/jiwigo/usr/share/jiwigo/jiwigo.jar \;
43
44#delete temporary files
45find "$work_path" | egrep "~$" | perl -n -e 'system("rm $_");'
46
47#changes current directory
48cd "$work_path"
49
50#makes deb
51dpkg-deb --build jiwigo
52
53rm "$work_path/depot/jiwigo.deb"
54rm "$work_path/depot/Packages.gz"
55#moves deb
56mv -f "$work_path/jiwigo.deb" "$work_path/depot/jiwigo.deb"
57
58#makes Packages.gz
59cd "$work_path/depot"
60dpkg-scanpackages . /dev/null | gzip - > Packages.gz
61
62
63###############################################################################################
64#####################           Building    exe                  ##############################
65###############################################################################################
66
67echo '#####        building exe...          #####'
68cd $work_path
69work_path_for_sed="$(echo $work_path | sed 's/\//\\\//g')"
70sed 's/#jar_location/'$work_path_for_sed'\/jiwigo\/usr\/share\/jiwigo\/jiwigo.jar/g' templates/launch4j_template.xml > launch4j_tmp.xml
71sed 's/#exe_location/'$work_path_for_sed'\/jiwigo.exe/g' launch4j_tmp.xml > launch4j.xml
72rm launch4j_tmp.xml
73$work_path/launch4j/launch4j $work_path/launch4j.xml
74rm launch4j.xml
75
76
77###############################################################################################
78#####################           completes generation folder      ##############################
79###############################################################################################
80
81echo '##### completing generation folder... #####'
82rm $work_path/generation/*
83mv $work_path/jiwigo.exe $work_path/generation/
84cp $work_path/depot/jiwigo.deb $work_path/generation/
85cp $work_path/jiwigo/usr/share/jiwigo/jiwigo.jar $work_path/generation/
86cd $project_path/
87tar -zcf $work_path/generation/jiwigo-src.tar.gz --exclude '.*' src pom.xml install
88echo '#####             Done                #####'
Note: See TracBrowser for help on using the repository browser.