Skip to content

Commit dfeeadb

Browse files
authored
crosscompile enhancements (#1947)
* crosscompile: do not check path existence for GRASS_SH when defined by the user * Remove % from env vars in comments * Compile addons * Define MODULE_TOPDIR once * Change the directory before compiling addons * Add git clone grass-addons to usage
1 parent 182c2d0 commit dfeeadb

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

mswindows/crosscompile.sh

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# MODULE: crosscompile.sh
66
# AUTHOR(S): Huidae Cho <grass4u gmail.com>
77
# PURPOSE: Builds a cross-compiled portable package of GRASS GIS
8-
# COPYRIGHT: (C) 2019, 2020 by Huidae Cho and the GRASS Development Team
8+
# COPYRIGHT: (C) 2019-2021 by Huidae Cho and the GRASS Development Team
99
#
1010
# This program is free software under the GNU General Public
1111
# License (>=v2). Read the file COPYING that comes with GRASS
@@ -15,7 +15,9 @@
1515
#
1616
# This script requires MXE <https://mxe.cc/> for cross-compilation and was
1717
# tested on Slackware 14.2 x86_64 with up-to-date packages from slackpkg and
18-
# sbopkg.
18+
# sbopkg. It was also tested on WSLackware
19+
# <https://github.com/Mohsens22/WSLackware> in WSL
20+
# <https://docs.microsoft.com/en-us/windows/wsl/>.
1921
#
2022
# Basic steps:
2123
#
@@ -29,6 +31,7 @@
2931
#
3032
# cd ~/usr/src
3133
# git clone https://github.com/OSGeo/grass.git
34+
# git clone https://github.com/OSGeo/grass-addons.git
3235
# cd grass
3336
# mswindows/crosscompile.sh --mxe-path=$HOME/usr/src/mxe --update --package \
3437
# > crosscompile.log 2>&1
@@ -39,6 +42,7 @@ set -e
3942

4043
# default paths, but can be overriden from the command line
4144
mxe_path=${MXE_PATH-$HOME/usr/local/src/mxe}
45+
addons_path=${ADDONS_PATH-../grass-addons}
4246
freetype_include=${FREETYPE_INCLUDE-/usr/include/freetype2}
4347

4448
# process options
@@ -52,6 +56,7 @@ Usage: crosscompile.sh [OPTIONS]
5256
5357
-h, --help display this help message
5458
--mxe-path=PATH MXE path (default: $HOME/usr/local/src/mxe)
59+
--addons-path=PATH grass-addons path (default: ../grass-addons)
5560
--freetype-include=PATH FreeType include path
5661
(default: /usr/include/freetype2)
5762
--update update the current branch
@@ -63,6 +68,9 @@ EOT
6368
--mxe-path=*)
6469
mxe_path=`echo $opt | sed 's/^[^=]*=//'`
6570
;;
71+
--addons-path=*)
72+
addons_path=`echo $opt | sed 's/^[^=]*=//'`
73+
;;
6674
--freetype-include=*)
6775
freetype_include=`echo $opt | sed 's/^[^=]*=//'`
6876
;;
@@ -137,6 +145,18 @@ LDFLAGS="-lcurses" \
137145

138146
make clean default
139147

148+
if [ -d $addons_path ]; then
149+
MODULE_TOPDIR=`pwd`
150+
(
151+
cd $addons_path
152+
if [ $update -eq 1 -a -d .git ]; then
153+
git pull
154+
fi
155+
cd src
156+
make MODULE_TOPDIR=$MODULE_TOPDIR clean default
157+
)
158+
fi
159+
140160
build_arch=`sed -n '/^ARCH[ \t]*=/{s/^.*=[ \t]*//; p}' include/Make/Platform.make`
141161
for i in \
142162
config.log \
@@ -185,6 +205,17 @@ PKG_CONFIG=$mxe_bin-pkg-config \
185205

186206
make clean default
187207

208+
if [ -d $addons_path ]; then
209+
(
210+
cd $addons_path
211+
if [ $update -eq 1 -a -d .git ]; then
212+
git pull
213+
fi
214+
cd src
215+
make MODULE_TOPDIR=$MODULE_TOPDIR clean default
216+
)
217+
fi
218+
188219
arch=`sed -n '/^ARCH[ \t]*=/{s/^.*=[ \t]*//; p}' include/Make/Platform.make`
189220
for i in \
190221
config.log \
@@ -306,12 +337,14 @@ rem set GRASS_PYTHON=%~d0\Python39\python.exe
306337
set GISBASE=%~dp0
307338
set GISBASE=%GISBASE:~0,-1%
308339
309-
rem If %GRASS_SH% is externally defined, that shell will be used; Otherwise,
310-
rem %GISBASE%\etc\sh.exe will be used if it exists; If not, cmd.exe will be
311-
rem used; This check is mainly for supporting BusyBox for Windows
340+
rem If GRASS_SH is externally defined, that shell will be used; Otherwise,
341+
rem GISBASE\etc\sh.exe will be used if it exists; If not, cmd.exe will be used;
342+
rem This check is mainly for supporting BusyBox for Windows
312343
rem (https://frippery.org/busybox/)
313-
if not defined GRASS_SH set GRASS_SH=%GISBASE%\etc\sh.exe
314-
if not exist "%GRASS_SH%" set GRASS_SH=
344+
if not defined GRASS_SH (
345+
set GRASS_SH=%GISBASE%\etc\sh.exe
346+
if not exist "!GRASS_SH!" set GRASS_SH=
347+
)
315348
316349
set GRASS_PROJSHARE=%GISBASE%\share\proj
317350

0 commit comments

Comments
 (0)