Skip to content

Commit

Permalink
Merge pull request #116 from anka-213/fix-binary-package-build
Browse files Browse the repository at this point in the history
Update scripts to use `cabal v1-...` so they work on newer cabal
  • Loading branch information
inariksit authored Jul 25, 2021
2 parents bb51224 + 8814fde commit b8324fe
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 28 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build-all-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v2
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'

- uses: actions/setup-haskell@v1.1.4
- uses: haskell/actions/setup@v1
id: setup-haskell-cabal
name: Setup Haskell
with:
Expand Down Expand Up @@ -73,11 +73,12 @@ jobs:
- uses: actions/checkout@v2
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'

- uses: actions/setup-haskell@v1.1.4
- uses: haskell/actions/setup@v1
name: Setup Haskell Stack
with:
# ghc-version: ${{ matrix.ghc }}
stack-version: ${{ matrix.stack }}
ghc-version: ${{ matrix.ghc }}
stack-version: 'latest'
enable-stack: true

- uses: actions/cache@v1
name: Cache ~/.stack
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/build-binary-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@ name: Build Binary Packages

on:
workflow_dispatch:
release:
release:
types: ["created"]

jobs:

# ---

ubuntu:
name: Build Ubuntu package
runs-on: ubuntu-18.04
# strategy:
# matrix:
# ghc: ["8.6.5"]
# cabal: ["2.4"]
strategy:
matrix:
os:
- ubuntu-18.04
- ubuntu-20.04

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -53,7 +56,7 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: gf-${{ github.sha }}-ubuntu
name: gf-${{ github.sha }}-${{ matrix.os }}
path: dist/gf_*.deb
if-no-files-found: error

Expand Down
41 changes: 29 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,48 @@
.PHONY: all build install doc clean gf html deb pkg bintar sdist
.PHONY: all build install doc clean html deb pkg bintar sdist

# This gets the numeric part of the version from the cabal file
VERSION=$(shell sed -ne "s/^version: *\([0-9.]*\).*/\1/p" gf.cabal)

# Check if stack is installed
STACK=$(shell if hash stack 2>/dev/null; then echo "1"; else echo "0"; fi)

# Check if cabal >= 2.4 is installed (with v1- and v2- commands)
CABAL_NEW=$(shell if cabal v1-repl --help >/dev/null 2>&1 ; then echo "1"; else echo "0"; fi)

ifeq ($(STACK),1)
CMD=stack
else
CMD=cabal
ifeq ($(CABAL_NEW),1)
CMD_PFX=v1-
endif
endif

all: build

dist/setup-config: gf.cabal Setup.hs WebSetup.hs
cabal configure
ifneq ($(STACK),1)
cabal ${CMD_PFX}configure
endif

build: dist/setup-config
cabal build
${CMD} ${CMD_PFX}build

install:
cabal copy
cabal register
ifeq ($(STACK),1)
stack install
else
cabal ${CMD_PFX}copy
cabal ${CMD_PFX}register
endif

doc:
cabal haddock
${CMD} ${CMD_PFX}haddock

clean:
cabal clean
${CMD} ${CMD_PFX}clean
bash bin/clean_html

gf:
cabal build rgl-none
strip dist/build/gf/gf

html::
bash bin/update_html

Expand All @@ -35,7 +52,7 @@ html::
deb:
dpkg-buildpackage -b -uc

# Make an OS X Installer package
# Make a macOS installer package
pkg:
FMT=pkg bash bin/build-binary-dist.sh

Expand Down
10 changes: 5 additions & 5 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ override_dh_shlibdeps:
override_dh_auto_configure:
cd src/runtime/c && bash setup.sh configure --prefix=/usr
cd src/runtime/c && bash setup.sh build
cabal update
cabal install --only-dependencies
cabal configure --prefix=/usr -fserver -fc-runtime --extra-lib-dirs=$(CURDIR)/src/runtime/c/.libs --extra-include-dirs=$(CURDIR)/src/runtime/c
cabal v1-update
cabal v1-install --only-dependencies
cabal v1-configure --prefix=/usr -fserver -fc-runtime --extra-lib-dirs=$(CURDIR)/src/runtime/c/.libs --extra-include-dirs=$(CURDIR)/src/runtime/c

SET_LDL=LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(CURDIR)/src/runtime/c/.libs

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
-$(SET_LDL) cabal v1-build

override_dh_auto_install:
$(SET_LDL) cabal copy --destdir=$(CURDIR)/debian/gf
$(SET_LDL) cabal v1-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
Expand Down

0 comments on commit b8324fe

Please sign in to comment.