-
Notifications
You must be signed in to change notification settings - Fork 0
/
maksvn
248 lines (211 loc) · 7.67 KB
/
maksvn
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
#!/bin/sh
#
# maksvn script creates folders for out of source build
# has command line options for really clean build, creating diffs and for svn update
# has various inline options to EDIT to fit your environnement
#
# Sourcepath, qt library and destination folders can be set to user conveninence
# but sourcepath will later contain both the 'svn' subfolder and the 'build' subfolder
# ('svn' receives svn repo clone, 'build' receive build objects)
#
# Author : JLuc, for Passerelle Eco - www.passerelleco.info
# Licence : GPL
# Main repo : https://github.com/JLuc/makscribus/
#### Preliminary notice
# No bad issue has ever been reported so far with these scripts but they sure can be improved.
# - The author or the scribus team are NOT responsible for your computer crash or data loss.
# - Use this at your own risk.
# - Pull requests are wellcome !
#
# TODO : use crudini or some other tool to parse ini file for all document related settings
#
# Set to user convenience
sourcepath=~/dev/scribus
# EDIT to fit your Qt install
qtpath="/localbin/Qt5.6.0/5.6"
# Default could be execdirpath=~/bin
# but so it got chances to be on SSD, it goes to /locabin
# EDIT to fit your exec folder
execdirpath=/localbin
# DONT Edit but keep synced : it must reflect the make process result (probably depends on makefile)
# Once was "scribus-1.5.0.svn" but changed to "scribus-1.5.0" when 1.5 release was approaching,
# and later became scribus-1.5.2.svn
makeexecname="scribus-1.5.3.svn"
# EDIT to fit your langage
mylang="fr;en-us"
# EDIT to fit your cpu cores = possible parallel processes
cores=8
# Uncomment and edit to compile an old revision or to not update
# OR use the -r 19232 option in the command line
# possible values are "" (empty string) or a revision number or "noup" or "nomaj" so as to not update nor checkout
# revision=19507 # to "update" to said revision
# Note : revision=noup is the same as -noup option
revision="" # for latest svn
# EDIT Suffix for executable
# for example : when suffix is 151svn, executable will be scribus151svn
# first command line specifies nickname for release to compile and related suffix
if [ "$1" = "1.5.2" ] || [ "$1" = "152" ] || [ "$1" = "-1.5.2" ] || [ "$1" = "-152" ]
then
shift
# preset config for scribus 1.5.2 release
suffix=152
makeexecname="scribus-1.5.2"
revision=21331
else if [ "$1" = "ok" ] || [ "$1" = "-ok" ] || [ "$1" = "preboxes" ] || [ "$1" = "-preboxes" ]
then
shift
# preset config for scribus 1.5.2svn r21106 preboxes release
suffix=ok
makeexecname="scribus-1.5.2.svn"
revision=21106
else
suffix=153svn
#revision = svn head
fi
fi
# More options for cmake. Do include the -
usercmakeopt=" -DWANT_DEBUG=1 "
# More options for make. Do include the -
usermakeopt=""
# End of user editable part
####################################################"
qtfullpath=$qtpath/gcc_64
if [ "$1" = "-?" ] || [ "$1" = "?" ] || [ "$1" = "-h" ] || [ "$1" = "h" ] || [ "$1" = "help" ] || [ "$1" = "-help" ]
then
echo
echo "Usage : maksvn ([152] or [ok] or [preboxes] or nothing) [-h]or[-?] [diff [dest]] [-d]ou[clean] [-r #####] [-nomaj]"
echo "=== OPTIONS ==================== the options order matters"
echo "=== Compiled svn version"
echo "with 'ok' or 'preboxes' : last version before 'boxes' patch is merged (well tested)"
echo "with '152' : scribus 1.5.2 is compiled (including 'boxes' patch, pdf-export is not thoroughfully tested)"
echo "without version option : svn fetches 1.5.3 svn head including experimental patches toward CTL (could include lot of new issues)"
echo "=== Other options"
echo "-h or -? display this help"
echo "-diff or diff : creates the diff file 'dest.diff' (or 'svnhead.diff' when no dest filename is specified)"
echo "-d or clean : Deletes previous build files (not the execs)"
echo "-r ##### : updates to old revision n°##### (default : update to head or to svn revision depending on the specified compiled svn version)"
echo "-noup or -nomaj : dont update sources at all"
echo
echo === SVN INFO ======================
svn info
exit
fi
echo ================================
[ ! -d $execdirpath ] && mkdir $execdirpath
[ ! -d $execdirpath ] && echo "Error : exec folder '$execdirpath' does not exist. Create $execdirpath before launching maksvn" && exit
[ ! -d $sourcepath ] && mkdir $sourcepath
[ ! -d $sourcepath ] && echo "Error : source folder $sourcepath could not be created. Create it before launching maksvn" && exit
cd $sourcepath
[ ! -d build ] && mkdir build
[ ! -d build ] && echo "Error : build folder $sourcepath/build could not be created. Create it before launching maksvn" && exit
[ ! -d build/$suffix ] && mkdir build/$suffix
[ ! -d build/$suffix ] && echo "Error : build folder $sourcepath/build/$suffix could not be created. Create it before launching maksvn" && exit
# first svn checkout
if [ ! -d "svn" ];
then
echo "Creating source folder and checkout svn files"
svn co svn://scribus.net/trunk/Scribus svn
fi
[ ! -d "svn" ] && echo "Error : no svn folder could be created" && exit
cd svn
pwd
if [ "$1" = "diff" ] || [ "$1" = "-diff" ]
then
if test "$2" = ""
then
dest="svnhead.diff"
else dest="${2%.diff}.diff"
fi
echo Lets produce the diff in $dest
destroot="$dest"
dest="../$dest"
if [ -f $dest ];
then
echo "Deleting $dest"
rm $dest
fi
svn diff -x -u -x -w -x -b > $dest
if [ -f $dest ];
then
cat $dest
echo "===="
echo "The diff was produced in $destroot"
geany $dest
else
# echo "$dest n'a pas pu être produit alors voici en direct : "
echo "! The diff has NOT been put in $destroot !"
echo "$dest could not be produced so here live"
echo "==== !"
svn diff -x -u -x -w -x -b
echo "==== !"
fi
exit
fi
maketarget=""
if [ "$1" = "-d" ] || [ "$1" = "d" ] || [ "$1" = "-clean" ] || [ "$1" = "clean" ]
then
shift
clean="-d"
maketarget="clean"
echo
echo "Deleting the foregoing build objects $sourcepath/build/$suffix/*"
rm -rf $sourcepath/build/$suffix/*
echo "$sourcepath/build/$suffix was emptied --- it now contains :"
ls $sourcepath/build/$suffix
echo
fi
if [ "$1" = "-r" ]
then
if [ "$2" = "" ]
then
echo Error : revision missing after -r
exit
fi
revision=$2
shift
shift
fi
if [ "$1" = "-noup" ] || [ "$1" = "-nomaj" ]
then
shift
revision="noup"
fi
if [ "$revision" = "noup" ] || [ "$revision" = "nomaj" ]
then
echo "NOT updating svn update"
elif [ "$revision" != "" ]
then
echo
echo "! Updating to revision $revision !"
svn update -r $revision
else
echo
echo "Updating to svn"
svn update
fi
echo
echo ===
cd ../build/$suffix
pwd
echo cmake to $execdirpath/scribus$suffix with qtfullpath=$qtfullpath
echo cmake ../../svn $usercmakeopt -DCMAKE_INSTALL_PREFIX:PATH=$execdirpath/scribus$suffix -DWANT_GUI_LANG="$mylang" -DWANT_VERSIONING=1 -DQT_PREFIX=$qtfullpath -DWANT_HUNSPELL=1 -DWANT_GRAPHICSMAGICK=1 -DWANT_SVNVERSION=1 -DCMAKE_EXE_LINKER_FLAGS="-L$qtfullpath/lib -lQt5Quick -lQt5PrintSupport"
cmake ../../svn $usercmakeopt -DCMAKE_INSTALL_PREFIX:PATH=$execdirpath/scribus$suffix -DWANT_GUI_LANG="$mylang" -DWANT_VERSIONING=1 -DQT_PREFIX=$qtfullpath -DWANT_HUNSPELL=1 -DWANT_GRAPHICSMAGICK=1 -DWANT_SVNVERSION=1 -DCMAKE_EXE_LINKER_FLAGS="-L$qtfullpath/lib -lQt5Quick -lQt5PrintSupport"
echo sudo chown -R $USER:$USER $sourcepath/build/$suffix
sudo chown -R $USER:$USER $sourcepath/build/$suffix
# sudo chmod u+rwx /usr/local/src
echo
echo ===
echo make -j$cores $usermakeopt $maketarget
make -j$cores $usermakeopt $maketarget
echo
echo ===
echo make -j$cores install
sudo make -j$cores install
echo
echo ===
sudo unlink /usr/bin/scribus$suffix
sudo ln -s $execdirpath/scribus$suffix/bin/$makeexecname /usr/bin/scribus$suffix
cd ../../svn
echo "SVN version" `svnversion`
echo exec is $execdirpath/scribus$suffix/bin/$makeexecname
echo Run with scribus$suffix