summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build-all-versions.yml8
-rw-r--r--.github/workflows/build-debian-package.yml26
-rw-r--r--.github/workflows/build-macos-package.yml43
-rw-r--r--.github/workflows/build-python-package.yml8
-rw-r--r--.github/workflows/build-windows-package.yml89
-rw-r--r--.gitignore6
-rwxr-xr-xbin/build-binary-dist.sh72
-rw-r--r--debian/control4
-rwxr-xr-xdebian/rules10
9 files changed, 195 insertions, 71 deletions
diff --git a/.github/workflows/build-all-versions.yml b/.github/workflows/build-all-versions.yml
index 52db74850..df71f0ac0 100644
--- a/.github/workflows/build-all-versions.yml
+++ b/.github/workflows/build-all-versions.yml
@@ -13,16 +13,16 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
- os: [ubuntu-latest, macOS-latest, windows-latest]
+ os: [ubuntu-latest, macos-latest, windows-latest]
cabal: ["3.2"]
ghc:
- "8.6.5"
- "8.8.3"
- "8.10.1"
exclude:
- - os: macOS-latest
+ - os: macos-latest
ghc: 8.8.3
- - os: macOS-latest
+ - os: macos-latest
ghc: 8.6.5
- os: windows-latest
ghc: 8.8.3
@@ -92,4 +92,4 @@ jobs:
# - name: Test
# run: |
- # stack test --system-ghc \ No newline at end of file
+ # stack test --system-ghc
diff --git a/.github/workflows/build-debian-package.yml b/.github/workflows/build-debian-package.yml
index 09719aaa8..02a0b3846 100644
--- a/.github/workflows/build-debian-package.yml
+++ b/.github/workflows/build-debian-package.yml
@@ -1,20 +1,20 @@
name: Build Debian Package
-on: [push, pull_request]
+on:
+ workflow_dispatch:
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
- fail-fast: true
matrix:
os: [ubuntu-18.04]
env:
LC_ALL: C.UTF-8
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v2
- name: Install build tools
run: |
@@ -27,23 +27,19 @@ jobs:
libghc-json-dev \
python-dev \
default-jdk \
- libtool-bin \
- txt2tags \
- pandoc
-
- - name: Checkout RGL
- run: |
- git clone --depth 1 https://github.com/GrammaticalFramework/gf-rgl.git ../gf-rgl
+ libtool-bin
- name: Build Debian package
run: |
make deb
- - name: Copy packages
+ - name: Copy package
run: |
- mkdir debian/dist
- cp ../gf_*.deb debian/dist/
+ cp ../gf_*.deb dist/
- - uses: actions/upload-artifact@v2
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
with:
- path: debian/dist
+ name: gf-${{ github.sha }}-debian
+ path: dist/gf_*.deb
+ if-no-files-found: error
diff --git a/.github/workflows/build-macos-package.yml b/.github/workflows/build-macos-package.yml
new file mode 100644
index 000000000..1ebf5dfa6
--- /dev/null
+++ b/.github/workflows/build-macos-package.yml
@@ -0,0 +1,43 @@
+name: Build macOS Package
+
+on:
+ workflow_dispatch:
+
+jobs:
+ build:
+ name: Build on ${{ matrix.os }}
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [macos-10.15]
+ ghc: ["8.6.5"]
+ cabal: ["2.4"]
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Setup Haskell
+ uses: actions/setup-haskell@v1
+ id: setup-haskell-cabal
+ with:
+ ghc-version: ${{ matrix.ghc }}
+ cabal-version: ${{ matrix.cabal }}
+
+ - name: Install build tools
+ run: |
+ brew install \
+ automake
+ cabal v1-install alex happy
+
+ - name: Build macOS package
+ run: |
+ sudo mkdir -p /Library/Java/Home
+ sudo ln -s /usr/local/opt/openjdk/include /Library/Java/Home/include
+ make pkg
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: gf-${{ github.sha }}-macos
+ path: dist/gf-*.pkg
+ if-no-files-found: error
diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml
index 921da9fb5..6326821dc 100644
--- a/.github/workflows/build-python-package.yml
+++ b/.github/workflows/build-python-package.yml
@@ -1,6 +1,10 @@
name: Build & Publish Python Package
-on: [push, pull_request]
+# Trigger the workflow on push or pull request, but only for the master branch
+on:
+ pull_request:
+ push:
+ branches: [master]
jobs:
build_wheels:
@@ -9,7 +13,7 @@ jobs:
strategy:
fail-fast: true
matrix:
- os: [ubuntu-18.04, macos-latest]
+ os: [ubuntu-18.04, macos-10.15]
steps:
- uses: actions/checkout@v1
diff --git a/.github/workflows/build-windows-package.yml b/.github/workflows/build-windows-package.yml
new file mode 100644
index 000000000..e56184840
--- /dev/null
+++ b/.github/workflows/build-windows-package.yml
@@ -0,0 +1,89 @@
+name: Build Windows Package
+
+on:
+ push: # testing until merged into master
+ workflow_dispatch:
+
+jobs:
+ build:
+ name: Build on ${{ matrix.os }}
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [windows-2019]
+ ghc: ["8.6.5"]
+ cabal: ["2.4"]
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Setup MSYS2
+ uses: msys2/setup-msys2@v2
+ with:
+ install: >-
+ base-devel
+ gcc
+
+ - name: Setup Haskell
+ uses: actions/setup-haskell@v1
+ id: setup-haskell-cabal
+ with:
+ ghc-version: ${{ matrix.ghc }}
+ cabal-version: ${{ matrix.cabal }}
+
+ - name: Install build tools
+ run: |
+ cabal install alex happy
+ pip install python-dev-tools
+
+ - name: Prepare dist folder
+ shell: msys2 {0}
+ run: |
+ mkdir /c/tmp-dist
+
+ - name: Build C runtime
+ shell: msys2 {0}
+ run: |
+ cd src/runtime/c
+ autoreconf -i
+ ./configure
+ make
+ make install
+ cp /mingw64/bin/libpgf-0.dll /c/tmp-dist
+ cp /mingw64/bin/libgu-0.dll /c/tmp-dist
+
+ - name: Build Java bindings
+ shell: msys2 {0}
+ run: |
+ export PATH="${PATH}:/c/Program Files/Java/jdk8u275-b01/bin"
+ cd src/runtime/java
+ make \
+ JNI_INCLUDES="-I \"/c/Program Files/Java/jdk8u275-b01/include\" -I \"/c/Program Files/Java/jdk8u275-b01/include/win32\" -I \"/mingw64/include\" -D__int64=int64_t" \
+ WINDOWS_LDFLAGS="-L\"/mingw64/lib\" -no-undefined"
+ make install
+ cp .libs//msys-jpgf-0.dll /c/tmp-dist/jpgf.dll
+ cp jpgf.jar /c/tmp-dist
+
+ - name: Build Python bindings
+ env:
+ EXTRA_INCLUDE_DIRS: /usr/local/include
+ EXTRA_LIB_DIRS: /usr/local/lib
+ run: |
+ cd src/runtime/python
+ python setup.py build
+ python setup.py install
+ # cp build/*/pgf.so /c/tmp-dist
+
+ - name: Build GF
+ run: |
+ cabal install --only-dependencies -fserver
+ cabal configure -fserver
+ cabal build
+ copy dist\build\gf\gf.exe C:\tmp-dist
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: gf-${{ github.sha }}-windows
+ path: C:\tmp-dist\*
+ if-no-files-found: error
diff --git a/.gitignore b/.gitignore
index 10968810e..01b58ccb4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,12 @@
*.jar
*.gfo
*.pgf
+debian/.debhelper
+debian/debhelper-build-stamp
+debian/gf
+debian/gf.debhelper.log
+debian/gf.substvars
+debian/files
dist/
dist-newstyle/
src/runtime/c/.libs/
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/debian/control b/debian/control
index a07187983..12eb6b9d9 100644
--- a/debian/control
+++ b/debian/control
@@ -3,14 +3,14 @@ Section: devel
Priority: optional
Maintainer: Thomas Hallgren <hallgren@chalmers.se>
Standards-Version: 3.9.2
-Build-Depends: debhelper (>= 5), haskell-platform (>= 2011.2.0.1), libghc-haskeline-dev, libghc-mtl-dev, libghc-json-dev, autoconf, automake, libtool-bin, python-dev, java-sdk, txt2tags, pandoc
+Build-Depends: debhelper (>= 5), haskell-platform (>= 2011.2.0.1), libghc-haskeline-dev, libghc-mtl-dev, libghc-json-dev, autoconf, automake, libtool-bin, python-dev, java-sdk
Homepage: http://www.grammaticalframework.org/
Package: gf
Architecture: any
Depends: ${shlibs:Depends}
Description: Tools for GF, a grammar formalism based on type theory
- Grammatical Framework (GF) is a grammar formalism based on type theory.
+ Grammatical Framework (GF) is a grammar formalism based on type theory.
It consists of a special-purpose programming language,
a compiler of the language, and a generic grammar processor.
.
diff --git a/debian/rules b/debian/rules
index 917801826..8bd3c1f85 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,6 +1,6 @@
#!/usr/bin/make -f
-%:
+%:
+dh $@
#dh_shlibdeps has a problem finding which package some of the Haskell
@@ -26,14 +26,10 @@ override_dh_auto_build:
cd src/runtime/python && EXTRA_INCLUDE_DIRS=$(CURDIR)/src/runtime/c EXTRA_LIB_DIRS=$(CURDIR)/src/runtime/c/.libs python setup.py build
cd src/runtime/java && make CFLAGS="-I$(CURDIR)/src/runtime/c -L$(CURDIR)/src/runtime/c/.libs" INSTALL_PATH=/usr
echo $(SET_LDL)
- -$(SET_LDL) cabal build # builds gf, fails to build example grammars
- export $(SET_LDL); PATH=$(CURDIR)/dist/build/gf:$$PATH && make -C ../gf-rgl build
- GF_LIB_PATH=$(CURDIR)/../gf-rgl/dist $(SET_LDL) cabal build # have RGL now, ok to build example grammars
- make html
+ -$(SET_LDL) cabal build
override_dh_auto_install:
- $(SET_LDL) cabal copy --destdir=$(CURDIR)/debian/gf # creates www directory
- export GF_LIB_PATH="$$(dirname $$(find "$(CURDIR)/debian/gf" -name www))/lib" && echo "GF_LIB_PATH=$$GF_LIB_PATH" && mkdir -p "$$GF_LIB_PATH" && make -C ../gf-rgl copy
+ $(SET_LDL) cabal copy --destdir=$(CURDIR)/debian/gf
cd src/runtime/c && bash setup.sh copy prefix=$(CURDIR)/debian/gf/usr
cd src/runtime/python && python setup.py install --prefix=$(CURDIR)/debian/gf/usr
cd src/runtime/java && make INSTALL_PATH=$(CURDIR)/debian/gf/usr install