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

Last change on this file was 58662, 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. 65-dev -> grass65-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="/c/OSGeo4W/bin/python.exe"
85export PYTHONHOME="/c/OSGeo4W/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 --enable-largefile \
127 --with-opengl=windows \
128 --with-fftw \
129 --with-freetype \
130 --with-proj-share=$OSGEO4W_ROOT_MSYS/share/proj \
131 --with-gdal=$PWD/mswindows/osgeo4w/gdal-config \
132 --with-geos=$PWD/mswindows/osgeo4w/geos-config \
133 --with-tcltk \
134 --with-sqlite \
135 --with-postgres \
136 --with-curses \
137 --with-regex \
138 --with-nls \
139 --with-freetype-includes=$OSGEO4W_ROOT_MSYS/include/freetype2 \
140 --with-odbc \
141 --with-cairo \
142 --with-cairo-includes=$OSGEO4W_ROOT_MSYS/include/cairo
143
144 touch mswindows/osgeo4w/configure-stamp
145fi
146
147log make
148make -k || ( cat error.log >&3 && false )
149
150log make install
151make install
152
153log cleanup
154mv $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass/config.h \
155 $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass/config.h.mingw
156cp mswindows/osgeo4w/config.h.switch $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass/config.h
157cp mswindows/osgeo4w/config.h.vc $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass
158mkdir -p $OSGEO4W_ROOT_MSYS/etc/preremove $OSGEO4W_ROOT_MSYS/etc/postinstall
159sed -e "s#@VERSION@#$VERSION#g" -e "s#@osgeo4w@#$OSGEO4W_ROOT#g" \
160 mswindows/osgeo4w/grass.bat.tmpl >$OSGEO4W_ROOT_MSYS/bin/${GRASS_EXECUTABLE}.bat
161sed -e "s#@VERSION@#$VERSION#g" -e "s#@OSGEO4W_ROOT_MSYS@#$OSGEO4W_ROOT_MSYS#g" -e "s#@POSTFIX@#$MAJOR$MINOR#g" \
162 mswindows/osgeo4w/grass.tmpl >$OSGEO4W_ROOT_MSYS/bin/${GRASS_EXECUTABLE}
163sed -e "s#@VERSION@#$VERSION#g" -e "s#@OSGEO4W_ROOT_MSYS@#$OSGEO4W_ROOT#g" \
164 mswindows/osgeo4w/env.bat.tmpl >$OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/etc/env.bat
165sed -e "s#@VERSION@#$VERSION#g" -e "s#@GRASS_EXECUTABLE@#$GRASS_EXECUTABLE#g" \
166 mswindows/osgeo4w/postinstall.bat >$OSGEO4W_ROOT_MSYS/etc/postinstall/${GRASS_EXECUTABLE}.bat
167sed -e "s#@VERSION@#$VERSION#g" -e "s#@GRASS_EXECUTABLE@#$GRASS_EXECUTABLE#g" \
168 mswindows/osgeo4w/preremove.bat >$OSGEO4W_ROOT_MSYS/etc/preremove/${GRASS_EXECUTABLE}.bat
169
170if [ -n "$PACKAGE" ]; then
171 log building vc libraries
172 sh mswindows/osgeo4w/mklibs.sh $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/lib/*.$VERSION.dll
173 mv mswindows/osgeo4w/vc/grass*.lib $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/lib
174 # rm $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/lib/*.dll
175
176 # log BUILDING GDAL GRASS plugins
177 # $COMSPEC /c "mswindows\\osgeo4w\\gdalplugins.cmd $VERSION"
178
179 log CREATING PACKAGES
180 mkdir -p mswindows/osgeo4w/package
181
182 PDIR=$PWD/mswindows/osgeo4w/package
183 SRC=$PWD
184 cd $OSGEO4W_ROOT_MSYS
185
186 sed -e "s#@VERSION@#$VERSION#g" \
187 $SRC/mswindows/osgeo4w/grass.bat.tmpl >$OSGEO4W_ROOT_MSYS/bin/${GRASS_EXECUTABLE}.bat.tmpl
188 sed -e "s#@VERSION@#$VERSION#g" \
189 $SRC/mswindows/osgeo4w/grass.tmpl >$OSGEO4W_ROOT_MSYS/bin/${GRASS_EXECUTABLE}.tmpl
190
191 # bat files - unix2dos
192 unix2dos bin/${GRASS_EXECUTABLE}.bat.tmpl
193 unix2dos bin/${GRASS_EXECUTABLE}.tmpl
194 unix2dos etc/postinstall/${GRASS_EXECUTABLE}.bat
195 unix2dos etc/preremove/${GRASS_EXECUTABLE}.bat
196
197 # grass package
198 tar -cjf $PDIR/grass$PACKAGE_NAME-$VERSION-$PACKAGE.tar.bz2 \
199 apps/grass/grass-$VERSION \
200 bin/${GRASS_EXECUTABLE}.bat.tmpl \
201 bin/${GRASS_EXECUTABLE}.tmpl \
202 etc/postinstall/${GRASS_EXECUTABLE}.bat \
203 etc/preremove/${GRASS_EXECUTABLE}.bat
204
205 rm bin/${GRASS_EXECUTABLE}.tmpl
206 rm bin/${GRASS_EXECUTABLE}.bat.tmpl
207
208 # grass-devel package (obsolete)
209 ###tar -cjf $PDIR/grass-devel-$VERSION-$PACKAGE.tar.bz2 \
210 ###apps/grass/grass-$VERSION/include
211
212 # grass-devel-mingw package (obsolete)
213 ###tar -cjf $PDIR/grass-devel-mingw-$VERSION-$PACKAGE.tar.bz2 \
214 ###apps/grass/grass-$VERSION/lib/*.a
215
216 # grass-devel-vc package (obsolete)
217 ###tar -cjf $PDIR/grass-devel-vc-$VERSION-$PACKAGE.tar.bz2 \
218 ###apps/grass/grass-$VERSION/lib/*.lib
219
220 # grass-locale package (obsolete)
221 ###tar -cjf $PDIR/grass-locale-$VERSION-$PACKAGE.tar.bz2 \
222 ###apps/grass/grass-$VERSION/locale
223fi
224
225log
226
227exit 0
Note: See TracBrowser for help on using the repository browser.