source: grass/branches/releasebranch_6_4/mswindows/osgeo4w/package.sh

Last change on this file was 58663, checked in by martinl, 11 years ago

winGRASS: fix subversion path - installed in c:\Subversion

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id
  • Property svn:mime-type set to text/x-sh
File size: 7.0 KB
Line 
1#!sh
2
3set -e
4
5PWD="$(pwd)"
6
7if ! [ -d mswindows ]; then
8 echo Start from GRASS toplevel dir
9 exit 1
10fi
11
12if ! [ -d /tmp ]; then
13 mkdir /tmp
14 if ! [ -d /tmp ]; then
15 echo /tmp does not exists
16 exit 1
17 fi
18fi
19
20export PACKAGE=${1:-1}
21# package name for osgeo4w
22# eg. 64-dev -> grass64-dev, empty for release
23export PACKAGE_NAME=$2
24# OSGeo4W directory postfix, separate OSGeo4W installations are used
25# for building GRASS 6.x and 7.x
26if test -z "$3" ; then
27 OSGEO4W_ROOT_POSTFIX=""
28else
29 OSGEO4W_ROOT_POSTFIX="$3"
30fi
31export OSGEO4W_ROOT_MSYS="/c/OSGeo4W${OSGEO4W_ROOT_POSTFIX}"
32export OSGEO4W_ROOT="C:\\\OSGeo4W${OSGEO4W_ROOT_POSTFIX}"
33
34export PATH=.:/usr/local/bin:/bin:$OSGEO4W_ROOT_MSYS/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/Subversion/bin:$PWD/mswindows/osgeo4w
35
36T0=$(date +%s)
37LT=$T0
38CS=""
39
40log() {
41 local D T
42 NOW=$(date)
43 T=$(date +%s)
44
45 if [ -n "$CS" ]; then
46 local D H M S
47 (( S=T-$LT ))
48 (( M=S/60 )); (( S=S%60 ))
49 (( H=M/60 )); (( M=M%60 ))
50 (( D=H/24 )); (( H=H%24 ))
51
52 echo -n "$NOW: FINISHED $CS AFTER "
53 (( D>0 )) && echo -n "${D}d"
54 (( H>0 )) && echo -n "${H}h"
55 (( M>0 )) && echo -n "${M}m"
56 echo "${S}s"
57 fi
58
59 CS="$@"
60 LT=$T
61 if [ -n "$CS" ]; then
62 echo $NOW: STARTING $CS
63 elif [ -n "$T0" ]; then
64 CS="COMPLETE RUN"
65 LT=$T0
66 T0=""
67 log
68 fi
69}
70
71exec 3<include/VERSION
72read MAJOR <&3
73read MINOR <&3
74read PATCH <&3
75
76export VERSION=$MAJOR.$MINOR.$PATCH
77
78if [[ "$PATCH" == *svn* ]] ; then
79 GRASS_EXECUTABLE=grass${MAJOR}${MINOR}svn
80else
81 GRASS_EXECUTABLE=grass${MAJOR}${MINOR}
82fi
83
84export GRASS_PYTHON="$OSGEO4W_ROOT_MSYS/bin/python.exe"
85export PYTHONHOME="$OSGEO4W_ROOT_MSYS/apps/Python27"
86
87if [ -f mswindows/osgeo4w/package.log ]; then
88 i=0
89 while [ -f mswindows/osgeo4w/package.log.$i ]; do
90 (( i++ ))
91 done
92 mv mswindows/osgeo4w/package.log mswindows/osgeo4w/package.log.$i
93fi
94
95exec 3>&1 >> mswindows/osgeo4w/package.log 2>&1
96
97[ -d mswindows/osgeo4w/lib ] || mkdir mswindows/osgeo4w/lib
98cp -uv $OSGEO4W_ROOT_MSYS/lib/sqlite3_i.lib mswindows/osgeo4w/lib/libsqlite3.a
99cp -uv $OSGEO4W_ROOT_MSYS/lib/proj_i.lib mswindows/osgeo4w/lib/libproj_i.a
100cp -uv $OSGEO4W_ROOT_MSYS/lib/libtiff_i.lib mswindows/osgeo4w/lib/libtiff.a
101cp -uv $OSGEO4W_ROOT_MSYS/lib/libpq.lib mswindows/osgeo4w/lib/libpq.a
102cp -uv $OSGEO4W_ROOT_MSYS/lib/jpeg_i.lib mswindows/osgeo4w/lib/libjpeg.a
103cp -uv $OSGEO4W_ROOT_MSYS/lib/zlib.lib mswindows/osgeo4w/lib/libz.a
104
105if ! [ -f mswindows/osgeo4w/configure-stamp ]; then
106
107 if [ -e include/Make/Grass.make ] ; then
108 log make distclean
109 make distclean
110 fi
111
112 log remove old logs
113 rm -f mswindows/osgeo4w/package.log.[0-9][0-9][0-9]
114
115 log configure
116 ./configure \
117 --with-libs="$OSGEO4W_ROOT_MSYS/lib $OSGEO4W_ROOT_MSYS/apps/msys/lib $PWD/mswindows/osgeo4w/lib" \
118 --with-includes="$OSGEO4W_ROOT_MSYS/include $OSGEO4W_ROOT_MSYS/apps/msys/include" \
119 --libexecdir=$OSGEO4W_ROOT_MSYS/bin \
120 --prefix=$OSGEO4W_ROOT_MSYS/apps/grass \
121 --bindir=$OSGEO4W_ROOT_MSYS/bin \
122 --includedir=$OSGEO4W_ROOT_MSYS/include \
123 --disable-x --without-x \
124 --with-cxx \
125 --enable-shared \
126 --with-opengl=windows \
127 --with-fftw \
128 --with-freetype \
129 --with-proj-share=$OSGEO4W_ROOT_MSYS/share/proj \
130 --with-gdal=$PWD/mswindows/osgeo4w/gdal-config \
131 --with-geos=$PWD/mswindows/osgeo4w/geos-config \
132 --with-tcltk \
133 --with-sqlite \
134 --with-postgres \
135 --with-curses \
136 --with-regex \
137 --with-nls \
138 --with-freetype-includes=$OSGEO4W_ROOT_MSYS/include/freetype2 \
139 --with-odbc \
140 --with-cairo \
141 --with-cairo-includes=$OSGEO4W_ROOT_MSYS/include/cairo
142
143 touch mswindows/osgeo4w/configure-stamp
144fi
145
146log make
147make -k || ( cat error.log >&3 && false )
148
149log make install
150make install
151
152log cleanup
153mv $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass/config.h \
154 $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass/config.h.mingw
155cp mswindows/osgeo4w/config.h.switch $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass/config.h
156cp mswindows/osgeo4w/config.h.vc $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass
157mkdir -p $OSGEO4W_ROOT_MSYS/etc/preremove $OSGEO4W_ROOT_MSYS/etc/postinstall
158sed -e "s#@VERSION@#$VERSION#g" -e "s#@osgeo4w@#$OSGEO4W_ROOT#g" \
159 mswindows/osgeo4w/grass.bat.tmpl >$OSGEO4W_ROOT_MSYS/bin/${GRASS_EXECUTABLE}.bat
160sed -e "s#@VERSION@#$VERSION#g" -e "s#@OSGEO4W_ROOT_MSYS@#$OSGEO4W_ROOT_MSYS#g" -e "s#@POSTFIX@#$MAJOR$MINOR#g" \
161 mswindows/osgeo4w/grass.tmpl >$OSGEO4W_ROOT_MSYS/bin/${GRASS_EXECUTABLE}
162sed -e "s#@VERSION@#$VERSION#g" -e "s#@OSGEO4W_ROOT_MSYS@#$OSGEO4W_ROOT#g" \
163 mswindows/osgeo4w/env.bat.tmpl >$OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/etc/env.bat
164sed -e "s#@VERSION@#$VERSION#g" -e "s#@GRASS_EXECUTABLE@#$GRASS_EXECUTABLE#g" \
165 mswindows/osgeo4w/postinstall.bat >$OSGEO4W_ROOT_MSYS/etc/postinstall/${GRASS_EXECUTABLE}.bat
166sed -e "s#@VERSION@#$VERSION#g" -e "s#@GRASS_EXECUTABLE@#$GRASS_EXECUTABLE#g" \
167 mswindows/osgeo4w/preremove.bat >$OSGEO4W_ROOT_MSYS/etc/preremove/${GRASS_EXECUTABLE}.bat
168
169if [ -n "$PACKAGE" ]; then
170 log building vc libraries
171 sh mswindows/osgeo4w/mklibs.sh $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/lib/*.$VERSION.dll
172 mv mswindows/osgeo4w/vc/grass*.lib $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/lib
173 # rm $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/lib/*.dll
174
175 # log BUILDING GDAL GRASS plugins
176 # $COMSPEC /c "mswindows\\osgeo4w\\gdalplugins.cmd $VERSION"
177
178 log CREATING PACKAGES
179 mkdir -p mswindows/osgeo4w/package
180
181 PDIR=$PWD/mswindows/osgeo4w/package
182 SRC=$PWD
183 cd $OSGEO4W_ROOT_MSYS
184
185 sed -e "s#@VERSION@#$VERSION#g" \
186 $SRC/mswindows/osgeo4w/grass.bat.tmpl >$OSGEO4W_ROOT_MSYS/bin/${GRASS_EXECUTABLE}.bat.tmpl
187 sed -e "s#@VERSION@#$VERSION#g" \
188 $SRC/mswindows/osgeo4w/grass.tmpl >$OSGEO4W_ROOT_MSYS/bin/${GRASS_EXECUTABLE}.tmpl
189
190 # bat files - unix2dos
191 unix2dos bin/${GRASS_EXECUTABLE}.bat.tmpl
192 unix2dos bin/${GRASS_EXECUTABLE}.tmpl
193 unix2dos etc/postinstall/${GRASS_EXECUTABLE}.bat
194 unix2dos etc/preremove/${GRASS_EXECUTABLE}.bat
195
196 # grass package
197 tar -cjf $PDIR/grass$PACKAGE_NAME-$VERSION-$PACKAGE.tar.bz2 \
198 apps/grass/grass-$VERSION \
199 bin/${GRASS_EXECUTABLE}.bat.tmpl \
200 bin/${GRASS_EXECUTABLE}.tmpl \
201 etc/postinstall/${GRASS_EXECUTABLE}.bat \
202 etc/preremove/${GRASS_EXECUTABLE}.bat
203
204 rm bin/${GRASS_EXECUTABLE}.tmpl
205 rm bin/${GRASS_EXECUTABLE}.bat.tmpl
206
207 # grass-devel package (obsolete)
208 ###tar -cjf $PDIR/grass-devel-$VERSION-$PACKAGE.tar.bz2 \
209 ###apps/grass/grass-$VERSION/include
210
211 # grass-devel-mingw package (obsolete)
212 ###tar -cjf $PDIR/grass-devel-mingw-$VERSION-$PACKAGE.tar.bz2 \
213 ###apps/grass/grass-$VERSION/lib/*.a
214
215 # grass-devel-vc package (obsolete)
216 ###tar -cjf $PDIR/grass-devel-vc-$VERSION-$PACKAGE.tar.bz2 \
217 ###apps/grass/grass-$VERSION/lib/*.lib
218
219 # grass-locale package (obsolete)
220 ###tar -cjf $PDIR/grass-locale-$VERSION-$PACKAGE.tar.bz2 \
221 ###apps/grass/grass-$VERSION/locale
222fi
223
224log
225
226exit 0
Note: See TracBrowser for help on using the repository browser.