Merge pull request #116 from anka-213/fix-binary-package-build

Update scripts to use `cabal v1-...` so they work on newer cabal
This commit is contained in:
Inari Listenmaa
2021-07-25 04:15:07 +02:00
committed by GitHub
4 changed files with 49 additions and 28 deletions

View File

@@ -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:
@@ -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

View File

@@ -2,7 +2,8 @@ name: Build Binary Packages
on:
workflow_dispatch:
release:
release:
types: ["created"]
jobs:
@@ -10,11 +11,13 @@ 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
@@ -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

View File

@@ -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
@@ -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

10
debian/rules vendored
View File

@@ -16,9 +16,9 @@ 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
@@ -26,10 +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
-$(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