Skip to content

Commit

Permalink
crosscompile enhancements (#1947)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
HuidaeCho committed Oct 16, 2021
1 parent 182c2d0 commit dfeeadb
Showing 1 changed file with 40 additions and 7 deletions.
47 changes: 40 additions & 7 deletions mswindows/crosscompile.sh
Expand Up @@ -5,7 +5,7 @@
# MODULE: crosscompile.sh
# AUTHOR(S): Huidae Cho <grass4u gmail.com>
# PURPOSE: Builds a cross-compiled portable package of GRASS GIS
# COPYRIGHT: (C) 2019, 2020 by Huidae Cho and the GRASS Development Team
# COPYRIGHT: (C) 2019-2021 by Huidae Cho and the GRASS Development Team
#
# This program is free software under the GNU General Public
# License (>=v2). Read the file COPYING that comes with GRASS
Expand All @@ -15,7 +15,9 @@
#
# This script requires MXE <https://mxe.cc/> for cross-compilation and was
# tested on Slackware 14.2 x86_64 with up-to-date packages from slackpkg and
# sbopkg.
# sbopkg. It was also tested on WSLackware
# <https://github.com/Mohsens22/WSLackware> in WSL
# <https://docs.microsoft.com/en-us/windows/wsl/>.
#
# Basic steps:
#
Expand All @@ -29,6 +31,7 @@
#
# cd ~/usr/src
# git clone https://github.com/OSGeo/grass.git
# git clone https://github.com/OSGeo/grass-addons.git
# cd grass
# mswindows/crosscompile.sh --mxe-path=$HOME/usr/src/mxe --update --package \
# > crosscompile.log 2>&1
Expand All @@ -39,6 +42,7 @@ set -e

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

# process options
Expand All @@ -52,6 +56,7 @@ Usage: crosscompile.sh [OPTIONS]
-h, --help display this help message
--mxe-path=PATH MXE path (default: $HOME/usr/local/src/mxe)
--addons-path=PATH grass-addons path (default: ../grass-addons)
--freetype-include=PATH FreeType include path
(default: /usr/include/freetype2)
--update update the current branch
Expand All @@ -63,6 +68,9 @@ EOT
--mxe-path=*)
mxe_path=`echo $opt | sed 's/^[^=]*=//'`
;;
--addons-path=*)
addons_path=`echo $opt | sed 's/^[^=]*=//'`
;;
--freetype-include=*)
freetype_include=`echo $opt | sed 's/^[^=]*=//'`
;;
Expand Down Expand Up @@ -137,6 +145,18 @@ LDFLAGS="-lcurses" \

make clean default

if [ -d $addons_path ]; then
MODULE_TOPDIR=`pwd`
(
cd $addons_path
if [ $update -eq 1 -a -d .git ]; then
git pull
fi
cd src
make MODULE_TOPDIR=$MODULE_TOPDIR clean default
)
fi

build_arch=`sed -n '/^ARCH[ \t]*=/{s/^.*=[ \t]*//; p}' include/Make/Platform.make`
for i in \
config.log \
Expand Down Expand Up @@ -185,6 +205,17 @@ PKG_CONFIG=$mxe_bin-pkg-config \

make clean default

if [ -d $addons_path ]; then
(
cd $addons_path
if [ $update -eq 1 -a -d .git ]; then
git pull
fi
cd src
make MODULE_TOPDIR=$MODULE_TOPDIR clean default
)
fi

arch=`sed -n '/^ARCH[ \t]*=/{s/^.*=[ \t]*//; p}' include/Make/Platform.make`
for i in \
config.log \
Expand Down Expand Up @@ -306,12 +337,14 @@ rem set GRASS_PYTHON=%~d0\Python39\python.exe
set GISBASE=%~dp0
set GISBASE=%GISBASE:~0,-1%
rem If %GRASS_SH% is externally defined, that shell will be used; Otherwise,
rem %GISBASE%\etc\sh.exe will be used if it exists; If not, cmd.exe will be
rem used; This check is mainly for supporting BusyBox for Windows
rem If GRASS_SH is externally defined, that shell will be used; Otherwise,
rem GISBASE\etc\sh.exe will be used if it exists; If not, cmd.exe will be used;
rem This check is mainly for supporting BusyBox for Windows
rem (https://frippery.org/busybox/)
if not defined GRASS_SH set GRASS_SH=%GISBASE%\etc\sh.exe
if not exist "%GRASS_SH%" set GRASS_SH=
if not defined GRASS_SH (
set GRASS_SH=%GISBASE%\etc\sh.exe
if not exist "!GRASS_SH!" set GRASS_SH=
)
set GRASS_PROJSHARE=%GISBASE%\share\proj
Expand Down

0 comments on commit dfeeadb

Please sign in to comment.