summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorkrangelov <kr.angelov@gmail.com>2021-01-20 20:16:26 +0100
committerkrangelov <kr.angelov@gmail.com>2021-01-20 20:16:26 +0100
commit04f6f113f07712a35128a924558dac9a3f83a822 (patch)
tree6f60a5dd879f17fd7a6b0c9c5de7daf1df7e374f /bin
parentbac619f025e8b3680e93cc64eddd9cebfc350249 (diff)
parentd77921005a429406398167c713969c6d807e56fa (diff)
Merge branch 'master' of https://github.com/GrammaticalFramework/gf-core
Diffstat (limited to 'bin')
-rwxr-xr-xbin/build-binary-dist.sh72
-rwxr-xr-xbin/update_html2
2 files changed, 32 insertions, 42 deletions
diff --git a/bin/build-binary-dist.sh b/bin/build-binary-dist.sh
index 7f6ca5d72..4ea1c31a3 100755
--- a/bin/build-binary-dist.sh
+++ b/bin/build-binary-dist.sh
@@ -1,15 +1,18 @@
#! /bin/bash
-### This script builds a binary distribution of GF from the source
-### package that this script is a part of. It assumes that you have installed
-### a recent version of the Haskell Platform.
-### Two binary package formats are supported: plain tar files (.tar.gz) and
-### OS X Installer packages (.pkg).
+### This script builds a binary distribution of GF from source.
+### It assumes that you have Haskell and Cabal installed.
+### Two binary package formats are supported (specified with the FMT env var):
+### - plain tar files (.tar.gz)
+### - macOS installer packages (.pkg)
os=$(uname) # Operating system name (e.g. Darwin or Linux)
hw=$(uname -m) # Hardware name (e.g. i686 or x86_64)
-# GF version number:
+cabal="cabal v1-" # Cabal >= 2.4
+# cabal="cabal " # Cabal <= 2.2
+
+## Get GF version number from Cabal file
ver=$(grep -i ^version: gf.cabal | sed -e 's/version://' -e 's/ //g')
name="gf-$ver"
@@ -29,6 +32,7 @@ set -x # print commands before executing them
pushd src/runtime/c
bash setup.sh configure --prefix="$prefix"
bash setup.sh build
+bash setup.sh install prefix="$prefix" # hack required for GF build on macOS
bash setup.sh install prefix="$destdir$prefix"
popd
@@ -38,11 +42,11 @@ if which >/dev/null python; then
EXTRA_INCLUDE_DIRS="$extrainclude" EXTRA_LIB_DIRS="$extralib" python setup.py build
python setup.py install --prefix="$destdir$prefix"
if [ "$fmt" == pkg ] ; then
- # A hack for Python on OS X to find the PGF modules
- pyver=$(ls "$destdir$prefix/lib" | sed -n 's/^python//p')
- pydest="$destdir/Library/Python/$pyver/site-packages"
- mkdir -p "$pydest"
- ln "$destdir$prefix/lib/python$pyver/site-packages"/pgf* "$pydest"
+ # A hack for Python on macOS to find the PGF modules
+ pyver=$(ls "$destdir$prefix/lib" | sed -n 's/^python//p')
+ pydest="$destdir/Library/Python/$pyver/site-packages"
+ mkdir -p "$pydest"
+ ln "$destdir$prefix/lib/python$pyver/site-packages"/pgf* "$pydest"
fi
popd
else
@@ -55,54 +59,40 @@ if which >/dev/null javac && which >/dev/null jar ; then
rm -f libjpgf.la # In case it contains the wrong INSTALL_PATH
if make CFLAGS="-I$extrainclude -L$extralib" INSTALL_PATH="$prefix"
then
- make INSTALL_PATH="$destdir$prefix" install
+ make INSTALL_PATH="$destdir$prefix" install
else
- echo "*** Skipping the Java binding because of errors"
+ echo "Skipping the Java binding because of errors"
fi
popd
else
echo "Java SDK is not installed, so the Java binding will not be included"
fi
-## To find dynamic C run-time libraries when running GF below
+## To find dynamic C run-time libraries when building GF below
export DYLD_LIBRARY_PATH="$extralib" LD_LIBRARY_PATH="$extralib"
-
## Build GF, with C run-time support enabled
-cabal install -w "$ghc" --only-dependencies -fserver -fc-runtime $extra
-cabal configure -w "$ghc" --prefix="$prefix" -fserver -fc-runtime $extra
-cabal build
- # Building the example grammars will fail, because the RGL is missing
-cabal copy --destdir="$destdir" # create www directory
-
-## Build the RGL and copy it to $destdir
-PATH=$PWD/dist/build/gf:$PATH
-export GF_LIB_PATH="$(dirname $(find "$destdir" -name www))/lib" # hmm
-mkdir -p "$GF_LIB_PATH"
-pushd ../gf-rgl
-make build
-make copy
-popd
-
-# Build GF again, including example grammars that need the RGL
-cabal build
+${cabal}install -w "$ghc" --only-dependencies -fserver -fc-runtime $extra
+${cabal}configure -w "$ghc" --prefix="$prefix" -fserver -fc-runtime $extra
+${cabal}build
## Copy GF to $destdir
-cabal copy --destdir="$destdir"
+${cabal}copy --destdir="$destdir"
libdir=$(dirname $(find "$destdir" -name PGF.hi))
-cabal register --gen-pkg-config=$libdir/gf-$ver.conf
+${cabal}register --gen-pkg-config="$libdir/gf-$ver.conf"
## Create the binary distribution package
case $fmt in
tar.gz)
- targz="$name-bin-$hw-$os.tar.gz" # the final tar file
- tar -C "$destdir/$prefix" -zcf "dist/$targz" .
- echo "Created $targz, consider renaming it to something more user friendly"
- ;;
+ targz="$name-bin-$hw-$os.tar.gz" # the final tar file
+ tar --directory "$destdir/$prefix" --gzip --create --file "dist/$targz" .
+ echo "Created $targz"
+ ;;
pkg)
- pkg=$name.pkg
- pkgbuild --identifier org.grammaticalframework.gf.pkg --version "$ver" --root "$destdir" --install-location / dist/$pkg
- echo "Created $pkg"
+ pkg=$name.pkg
+ pkgbuild --identifier org.grammaticalframework.gf.pkg --version "$ver" --root "$destdir" --install-location / dist/$pkg
+ echo "Created $pkg"
esac
+## Cleanup
rm -r "$destdir"
diff --git a/bin/update_html b/bin/update_html
index 912ff1fa0..717670085 100755
--- a/bin/update_html
+++ b/bin/update_html
@@ -147,7 +147,7 @@ else
fi
done
find . -name '*.md' | while read file ; do
- if [[ "$file" == *"README.md" ]] ; then continue ; fi
+ if [[ "$file" == *"README.md" ]] || [[ "$file" == *"RELEASE.md" ]] ; then continue ; fi
html="${file%.md}.html"
if [ "$file" -nt "$html" ] || [ "$template" -nt "$html" ] ; then
render_md_html "$file" "$html"