1
0
forked from GitHub/gf-rgl

First version of Make.bat, untested but basically complete

This commit is contained in:
John J. Camilleri
2018-07-30 15:58:36 +02:00
parent 56f530abab
commit 19020167f7
3 changed files with 114 additions and 12 deletions

101
Make.bat
View File

@@ -1,8 +1,101 @@
@echo off
Setlocal EnableDelayedExpansion
REM ---
REM Non-Haskell RGL build script for Windows machines
@ECHO OFF
REM ---
REM Prelude
REM Modules to compile for each language
set langs=Afr Amh Ara Eus Bul Cat Chi Dan Dut Eng Est Fin Fre Grc Gre Heb Hin Ger Ice Ina Ita Jpn Lat Lav Mlt Mon Nep Nor Nno Pes Pol Por Pnb Ron Rus Snd Spa Swe Tha Tur Urd
set modules_langs=All Symbol Compatibility
set modules_api=Try Symbolic
REM Present
REM Defaults (may be overridden by options)
set gf=gf-default
set dest=
set verbose=false
REM All tenses
REM Check command line options
set arg_gf_next=false
set arg_dest_next=false
for %%i in (%*) do (
if !arg_gf_next!==true (
set gf=%%i
set arg_gf_next=false
)
if !arg_dest_next!==true (
set dest=%%i
set arg_dest_next=false
)
if %%i==-v set verbose=true
if %%i==--verbose set verbose=true
if %%i==--gf set arg_gf_next=true
if %%i==--dest set arg_dest_next=true
)
REM Try to determine install location
if "%dest%"=="" (
set dest=%GF_LIB_PATH%
)
if "%dest%"=="" (
REM TODO Look in ../gf-core/DATA=DIR
)
if "%dest%"=="" (
echo Unable to determine where to install the RGL. Please do one of the following:
echo - Pass the --dest=... flag to this script
echo - Set the GF_LIB_PATH environment variable
REM echo - Compile & install GF from the gf-core repository (must be in same directory as gf-rgl)
exit /b
)
REM A few more definitions before we get started
set src=src
set dist=dist
set gfc=gf --batch --gf-lib-path=%src% --quiet
REM Redirect stderr if not verbose
if %verbose%==false (
set gfc=2>NUL !gfc!
)
REM Make directories if not present
mkdir %dist%\prelude
mkdir %dist%\present
mkdir %dist%\alltenses
REM Build: prelude
echo Building [prelude]
for /r %src%\prelude %%m in (*.gf) do (
%gfc% --gfo-dir=%dist%\prelude %%m
)
REM Gather all language modules for building
set modules=
for %%l in (%langs%) do (
for %%m in (%modules_langs%) do (
for /r %src% %%m in (*%%m%%l.gf) do (
set modules=!modules! %%m
)
)
for %%m in (%modules_api%) do (
for /r %src%\api %%m in (*%%m%%l.gf) do (
set modules=!modules! %%m
)
)
)
REM Build: present
echo Building [present]
for %%m in (%modules%) do (
%gfc% --no-pmcfg --gfo-dir=%dist%\present --preproc=mkPresent %%m
)
REM Build: alltenses
echo Building [alltenses]
for %%m in (%modules%) do (
%gfc% --no-pmcfg --gfo-dir=%dist%\alltenses %%m
)
REM Copy
echo Copying to %dest%
copy %dist% %dest%

18
Make.sh
View File

@@ -1,7 +1,11 @@
#!/bin/sh
# ---
# Non-Haskell RGL build script for Unix-based machines
# ---
# Modules to compile for each language
# langs="Afr Amh Ara Eus Bul Cat Chi Dan Dut Eng Est Fin Fre Grc Gre Heb Hin Ger Ice Ina Ita Jpn Lat Lav Mlt Mon Nep Nor Nno Pes Pol Por Pnb Ron Rus Snd Spa Swe Tha Tur Urd"
modules_langs="All Symbol Compatibility"
modules_api="Try Symbolic"
@@ -42,7 +46,12 @@ fi
# A few more definitions before we get started
src="src"
dist="dist"
gfc="${gf} --batch --gf-lib-path=${src} --quiet "
gfc="${gf} --batch --gf-lib-path=${src} --quiet"
# Redirect stderr if not verbose
if [ $verbose = false ]; then
exec 2> /dev/null
fi
# Make directories if not present
mkdir -p "${dist}/prelude"
@@ -65,15 +74,10 @@ for mod in $modules_api; do
done
done
# Redirect stderr if not verbose
if [ $verbose = false ]; then
exec 2> /dev/null
fi
# Build: present
echo "Building [present]"
for module in $modules; do
${gfc} --no-pmcfg --gfo-dir="${dist}"/present -preproc=mkPresent "${module}"
${gfc} --no-pmcfg --gfo-dir="${dist}"/present --preproc=mkPresent "${module}"
done
# Build: alltenses

View File

@@ -90,9 +90,14 @@ This build method tries to build all languages found in the `src` directory, eve
## Windows batch file: `Make.bat`
**This script is still untested.**
This method is provided as an alternative for Windows users who don't have Haskell installed.
**COMING SOON**
It is supposed to be a port of Make.sh and works in largely the same way.
In particular, it accepts the same flags (in the same format) as described above.
One difference is that the list of languages to be compiled is specified manually in the script in the `langs` variable.
## About this repository