forked from GitHub/gf-core
Remove RGL from build, use 'cabal v1-' commands
This commit is contained in:
2
.github/workflows/build-macos-package.yml
vendored
2
.github/workflows/build-macos-package.yml
vendored
@@ -1,6 +1,6 @@
|
|||||||
name: Build macOS Package
|
name: Build macOS Package
|
||||||
|
|
||||||
on: [push, pull_request]
|
on: workflow_dispatch
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
@@ -1,15 +1,18 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
### This script builds a binary distribution of GF from the source
|
### This script builds a binary distribution of GF from source.
|
||||||
### package that this script is a part of. It assumes that you have installed
|
### It assumes that you have Haskell and Cabal installed.
|
||||||
### a recent version of the Haskell Platform.
|
### Two binary package formats are supported (specified with the FMT env var):
|
||||||
### Two binary package formats are supported: plain tar files (.tar.gz) and
|
### - plain tar files (.tar.gz)
|
||||||
### OS X Installer packages (.pkg).
|
### - OS X installer packages (.pkg)
|
||||||
|
|
||||||
os=$(uname) # Operating system name (e.g. Darwin or Linux)
|
os=$(uname) # Operating system name (e.g. Darwin or Linux)
|
||||||
hw=$(uname -m) # Hardware name (e.g. i686 or x86_64)
|
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')
|
ver=$(grep -i ^version: gf.cabal | sed -e 's/version://' -e 's/ //g')
|
||||||
|
|
||||||
name="gf-$ver"
|
name="gf-$ver"
|
||||||
@@ -25,14 +28,13 @@ extra="--extra-lib-dirs=$extralib --extra-include-dirs=$extrainclude"
|
|||||||
set -e # Stop if an error occurs
|
set -e # Stop if an error occurs
|
||||||
set -x # print commands before executing them
|
set -x # print commands before executing them
|
||||||
|
|
||||||
cabal --version
|
|
||||||
|
|
||||||
## First configure & build the C run-time system
|
## First configure & build the C run-time system
|
||||||
pushd src/runtime/c
|
pushd src/runtime/c
|
||||||
bash setup.sh configure --prefix="$prefix"
|
bash setup.sh configure --prefix="$prefix"
|
||||||
bash setup.sh build
|
bash setup.sh build
|
||||||
bash setup.sh install prefix="$prefix"
|
## Install in two places:
|
||||||
bash setup.sh install prefix="$destdir$prefix"
|
# bash setup.sh install prefix="$prefix" # for GF build to find
|
||||||
|
bash setup.sh install prefix="$destdir$prefix" # for inclusion in distribution
|
||||||
popd
|
popd
|
||||||
|
|
||||||
## Build the python binding to the C run-time system
|
## Build the python binding to the C run-time system
|
||||||
@@ -60,47 +62,32 @@ if which >/dev/null javac && which >/dev/null jar ; then
|
|||||||
then
|
then
|
||||||
make INSTALL_PATH="$destdir$prefix" install
|
make INSTALL_PATH="$destdir$prefix" install
|
||||||
else
|
else
|
||||||
echo "*** Skipping the Java binding because of errors"
|
echo "Skipping the Java binding because of errors"
|
||||||
fi
|
fi
|
||||||
popd
|
popd
|
||||||
else
|
else
|
||||||
echo "Java SDK is not installed, so the Java binding will not be included"
|
echo "Java SDK is not installed, so the Java binding will not be included"
|
||||||
fi
|
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"
|
export DYLD_LIBRARY_PATH="$extralib" LD_LIBRARY_PATH="$extralib"
|
||||||
|
|
||||||
|
|
||||||
## Build GF, with C run-time support enabled
|
## Build GF, with C run-time support enabled
|
||||||
cabal install -w "$ghc" --only-dependencies -fserver -fc-runtime $extra
|
${cabal}install -w "$ghc" --only-dependencies -fserver -fc-runtime $extra
|
||||||
cabal configure -w "$ghc" --prefix="$prefix" -fserver -fc-runtime $extra
|
${cabal}configure -w "$ghc" --prefix="$prefix" -fserver -fc-runtime $extra
|
||||||
cabal build
|
${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
|
|
||||||
|
|
||||||
## Copy GF to $destdir
|
## Copy GF to $destdir
|
||||||
cabal copy --destdir="$destdir"
|
${cabal}copy --destdir="$destdir"
|
||||||
libdir=$(dirname $(find "$destdir" -name PGF.hi))
|
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
|
## Create the binary distribution package
|
||||||
case $fmt in
|
case $fmt in
|
||||||
tar.gz)
|
tar.gz)
|
||||||
targz="$name-bin-$hw-$os.tar.gz" # the final tar file
|
targz="$name-bin-$hw-$os.tar.gz" # the final tar file
|
||||||
tar -C "$destdir/$prefix" -zcf "dist/$targz" .
|
tar --directory "$destdir/$prefix" --gzip --create --file "dist/$targz" .
|
||||||
echo "Created $targz, consider renaming it to something more user friendly"
|
echo "Created $targz"
|
||||||
;;
|
;;
|
||||||
pkg)
|
pkg)
|
||||||
pkg=$name.pkg
|
pkg=$name.pkg
|
||||||
@@ -108,4 +95,5 @@ case $fmt in
|
|||||||
echo "Created $pkg"
|
echo "Created $pkg"
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
## Cleanup
|
||||||
rm -r "$destdir"
|
rm -r "$destdir"
|
||||||
|
|||||||
Reference in New Issue
Block a user