From aefac8467049947e4c1ee96694e7aec3e0648d7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Sat, 5 Mar 2022 10:04:36 +0800 Subject: [PATCH 01/17] Clear stack cache and make cache-key more fine-grained Attempt at fixing #137 --- .github/workflows/build-all-versions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-all-versions.yml b/.github/workflows/build-all-versions.yml index 9ab8a0622..33cc3668d 100644 --- a/.github/workflows/build-all-versions.yml +++ b/.github/workflows/build-all-versions.yml @@ -84,7 +84,7 @@ jobs: name: Cache ~/.stack with: path: ~/.stack - key: ${{ runner.os }}-${{ matrix.ghc }}-stack + key: ${{ runner.os }}-${{ matrix.ghc }}-stack--${{ hashFiles(format('stack-ghc{0}', matrix.ghc)) }} - name: Build run: | From bfd8f9c16db01da0b0ed31186f4388ccebde56ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Sat, 5 Mar 2022 10:42:10 +0800 Subject: [PATCH 02/17] Upgrade haskell setup action --- .github/workflows/build-all-versions.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-all-versions.yml b/.github/workflows/build-all-versions.yml index 33cc3668d..45b14ee77 100644 --- a/.github/workflows/build-all-versions.yml +++ b/.github/workflows/build-all-versions.yml @@ -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: haskell/actions/setup@v1 + - uses: haskell/actions/setup@v1.2.9 id: setup-haskell-cabal name: Setup Haskell with: @@ -73,7 +73,7 @@ jobs: - uses: actions/checkout@v2 if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master' - - uses: haskell/actions/setup@v1 + - uses: haskell/actions/setup@v1.2.9 name: Setup Haskell Stack with: ghc-version: ${{ matrix.ghc }} From 4caf6d684e1c236600563b4a9f3ed698111a05f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Sat, 5 Mar 2022 11:20:39 +0800 Subject: [PATCH 03/17] Another attempt at fixing linker errors --- .github/workflows/build-all-versions.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build-all-versions.yml b/.github/workflows/build-all-versions.yml index 45b14ee77..2217388db 100644 --- a/.github/workflows/build-all-versions.yml +++ b/.github/workflows/build-all-versions.yml @@ -80,6 +80,11 @@ jobs: stack-version: 'latest' enable-stack: true + + # Fix linker errrors on ghc-7.10.3 for ubuntu (see https://github.com/commercialhaskell/stack/blob/255cd830627870cdef34b5e54d670ef07882523e/doc/faq.md#i-get-strange-ld-errors-about-recompiling-with--fpic) + - run: sed -i.bak 's/"C compiler link flags", "/&-no-pie /' /home/runner/.ghcup/ghc/7.10.3/lib/ghc-7.10.3/settings + if: matrix.ghc == '7.10.3' + - uses: actions/cache@v1 name: Cache ~/.stack with: From 05fc093b5e067ea7250398647fd074acb79e4f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Sat, 5 Mar 2022 11:47:46 +0800 Subject: [PATCH 04/17] Add restore key to cache --- .github/workflows/build-all-versions.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-all-versions.yml b/.github/workflows/build-all-versions.yml index 2217388db..3472fa92b 100644 --- a/.github/workflows/build-all-versions.yml +++ b/.github/workflows/build-all-versions.yml @@ -90,6 +90,8 @@ jobs: with: path: ~/.stack key: ${{ runner.os }}-${{ matrix.ghc }}-stack--${{ hashFiles(format('stack-ghc{0}', matrix.ghc)) }} + restore-keys: | + ${{ runner.os }}-${{ matrix.ghc }}-stack - name: Build run: | From 308f4773dc8f939ca66977382047f734752d1ed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Sat, 5 Mar 2022 12:13:45 +0800 Subject: [PATCH 05/17] Upgrade to ghc-8.10.7 This version has better support for m1 macbooks --- .github/workflows/build-all-versions.yml | 4 ++-- stack-ghc8.10.4.yaml | 14 -------------- stack-ghc8.10.7.yaml | 12 ++++++++++++ stack.yaml | 9 +++------ 4 files changed, 17 insertions(+), 22 deletions(-) delete mode 100644 stack-ghc8.10.4.yaml create mode 100644 stack-ghc8.10.7.yaml diff --git a/.github/workflows/build-all-versions.yml b/.github/workflows/build-all-versions.yml index 3472fa92b..445493065 100644 --- a/.github/workflows/build-all-versions.yml +++ b/.github/workflows/build-all-versions.yml @@ -18,7 +18,7 @@ jobs: ghc: - "8.6.5" - "8.8.3" - - "8.10.1" + - "8.10.7" exclude: - os: macos-latest ghc: 8.8.3 @@ -66,7 +66,7 @@ jobs: strategy: matrix: stack: ["latest"] - ghc: ["7.10.3","8.0.2", "8.2.2", "8.4.4", "8.6.5", "8.8.4"] + ghc: ["7.10.3","8.0.2", "8.2.2", "8.4.4", "8.6.5", "8.8.4", "8.10.7"] # ghc: ["8.8.3"] steps: diff --git a/stack-ghc8.10.4.yaml b/stack-ghc8.10.4.yaml deleted file mode 100644 index b10f66e4f..000000000 --- a/stack-ghc8.10.4.yaml +++ /dev/null @@ -1,14 +0,0 @@ -resolver: lts-18.0 # ghc 8.10.4 - -extra-deps: -- network-2.6.3.6 -- httpd-shed-0.4.0.3 -- cgi-3001.5.0.0@sha256:3d1193a328d5f627a021a0ef3927c1ae41dd341e32dba612fed52d0e3a6df056,2990 -- json-0.10@sha256:d9fc6b07ce92b8894825a17d2cf14799856767eb30c8bf55962baa579207d799,3210 -- multipart-0.2.0@sha256:b8770e3ff6089be4dd089a8250894b31287cca671f3d258190a505f9351fa8a9,1084 - -# flags: -# gf: -# c-runtime: true -# extra-lib-dirs: -# - /usr/local/lib diff --git a/stack-ghc8.10.7.yaml b/stack-ghc8.10.7.yaml new file mode 100644 index 000000000..4b3f6643a --- /dev/null +++ b/stack-ghc8.10.7.yaml @@ -0,0 +1,12 @@ +resolver: lts-18.27 # ghc 8.10.7 + +extra-deps: +- network-2.6.3.6 +- httpd-shed-0.4.0.3 + +# flags: +# gf: +# server: true +# c-runtime: true +# extra-lib-dirs: +# - /usr/local/lib diff --git a/stack.yaml b/stack.yaml index 3a79afdf0..128b91f8a 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,18 +1,15 @@ -# This default stack file is a copy of stack-ghc8.10.4.yaml +# This default stack file is a copy of stack-ghc8.10.7.yaml # But committing a symlink can be problematic on Windows, so it's a real copy. # See: https://github.com/GrammaticalFramework/gf-core/pull/106 - -resolver: lts-18.0 # ghc 8.10.4 +resolver: lts-18.27 # ghc 8.10.7 extra-deps: - network-2.6.3.6 - httpd-shed-0.4.0.3 -- cgi-3001.5.0.0@sha256:3d1193a328d5f627a021a0ef3927c1ae41dd341e32dba612fed52d0e3a6df056,2990 -- json-0.10@sha256:d9fc6b07ce92b8894825a17d2cf14799856767eb30c8bf55962baa579207d799,3210 -- multipart-0.2.0@sha256:b8770e3ff6089be4dd089a8250894b31287cca671f3d258190a505f9351fa8a9,1084 # flags: # gf: +# server: true # c-runtime: true # extra-lib-dirs: # - /usr/local/lib From 3a1213ab378bbcbf09b631e4066b3056ec699528 Mon Sep 17 00:00:00 2001 From: Meng Weng Wong Date: Sun, 20 Feb 2022 22:13:26 +0800 Subject: [PATCH 06/17] prepare for GHC 9, base 4.15, by using Buffer constructor interface --- src/compiler/GF/Text/Coding.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/GF/Text/Coding.hs b/src/compiler/GF/Text/Coding.hs index bac7938c0..2a89427fe 100644 --- a/src/compiler/GF/Text/Coding.hs +++ b/src/compiler/GF/Text/Coding.hs @@ -38,7 +38,7 @@ decodeUnicode :: TextEncoding -> ByteString -> String decodeUnicode enc bs = unsafePerformIO $ decodeUnicodeIO enc bs decodeUnicodeIO enc (PS fptr l len) = do - let bbuf = Buffer{bufRaw=fptr, bufState=ReadBuffer, bufSize=len, bufL=l, bufR=l+len} + let bbuf = (emptyBuffer fptr len ReadBuffer) { bufL=l, bufR=l+len } cbuf <- newCharBuffer 128 WriteBuffer case enc of TextEncoding {mkTextDecoder=mk} -> do decoder <- mk From bc14a56f83402f73acd6540c9ec3cd278ddf986e Mon Sep 17 00:00:00 2001 From: Meng Weng Wong Date: Fri, 25 Feb 2022 14:31:10 +0800 Subject: [PATCH 07/17] "now try this" instructions for people flailing with Apple Silicon M1 --- src/runtime/python/README.org | 166 ++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 src/runtime/python/README.org diff --git a/src/runtime/python/README.org b/src/runtime/python/README.org new file mode 100644 index 000000000..8885694b5 --- /dev/null +++ b/src/runtime/python/README.org @@ -0,0 +1,166 @@ +* INSTALL + +You will need the python-devel package or similar. + +You must have installed the PGF C runtime (see ../c/INSTALL) + +#+begin_src sh + $ python setup.py build + $ sudo python setup.py install +#+end_src + +* Apple Silicon + +The following install instructions were written with the following config in mind: + +| OS | Hardware | GF | +|-----------------------+----------+--------------------------+ +| MacOS Monterey 12.2.1 | Apple M1 | 3.11 from binary package | + +We assume that you may have installed GF as a binary package downloaded from Github. + +From that starting point, try all the solutions below, in sequence, until you achieve success. + +** Validation Goal + +Our goal is to be able to +- run python 3 +- import pgf +- type "pgf." +- hit tab + +and get this: + +#+begin_example + >>> import pgf + >>> pgf. + pgf.BIND( pgf.Concr( pgf.Iter( pgf.PGFError( pgf.Type( pgf.readExpr( pgf.readType( + pgf.Bracket( pgf.Expr( pgf.PGF( pgf.ParseError( pgf.TypeError( pgf.readPGF( +#+end_example + +When that works, we can consider the Python PGF bindings to be installed successfully. + +** The GF binary package won't install + +We assume you've tried [[https://github.com/GrammaticalFramework/gf-core/releases][downloading a binary package]]. + +If MacOS is being secure, go to System Preferences, Security & Privacy, General, and click Open Anyway. + +** gu/mem.h file not found + +Maybe you tried running something like ~pip install pgf~ or ~pip3 install pgf~. + +Did you get this error? + +#+begin_example + python3 setup.py build + running build + running build_ext + creating build/temp.macosx-12-arm64-3.9 + clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -I/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c pypgf.c -o build/temp.macosx-12-arm64-3.9/pypgf.o -std=c99 + pypgf.c:5:10: fatal error: 'gu/mem.h' file not found + #include + ^~~~~~~~~~ + 1 error generated. + error: command '/usr/bin/clang' failed with exit code 1 +#+end_example + +Solution: + +#+begin_example + $ EXTRA_INCLUDE_DIRS=/usr/local/include EXTRA_LIB_DIRS=/usr/local/lib pip install pgf +#+end_example + +This should tell the build where to find the include and lib files it needs to compile: + +#+begin_example + $ ls /usr/local/include/gu + assert.h choice.h enum.h file.h hash.h map.h out.h seq.h sysdeps.h utf8.h + bits.h defs.h exn.h fun.h in.h mem.h prime.h string.h ucs.h variant.h + + $ ls /usr/local/lib/libgu* + /usr/local/lib/libgu.0.dylib /usr/local/lib/libgu.a /usr/local/lib/libgu.dylib /usr/local/lib/libgu.la +#+end_example + +If those files don't exist, or you get the following error, you will need to rebuild the C runtime. + +** symbol not found in flat namespace + +Did you get this error? + +#+begin_example + Python 3.9.10 (main, Jan 15 2022, 11:40:53) + [Clang 13.0.0 (clang-1300.0.29.3)] on darwin + Type "help", "copyright", "credits" or "license" for more information. + >>> import pgf + Traceback (most recent call last): + File "", line 1, in + ImportError: dlopen(/opt/homebrew/lib/python3.9/site-packages/pgf.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_gu_alloc_variant' +#+end_example + +This may be a sign that you're trying to get binaries and libraries compiled with different compilers to play nicely. We're trying to get three things to align: + +- the Python interpreter +- the C runtime libraries +- the Python pgf libraries + +Solution: + +Maybe your Python isn't the Apple-provided Python. In the above error message we see ~python3~ is provided by Homebrew. Assuming you prefer to keep things this way, we'll try to rebuild things to match your Python. + +Rebuilding needs a C compiler. The Apple-provided system ~clang~ is preferred. If you have multiple ~clang~ compilers installed, try disabling the others. For example, if your ~clang~ was provided by nix, run ~nix-env --uninstall clang~. Similarly for brew. + +Then try rebuilding the C runtime. + +** How to re-build the C runtime + +Maybe the C runtime is missing from ~/usr/local/lib~, or maybe the version you have installed is causing the "symbol not found" error. + +Build the C runtime by following the instructions in ~gf-core/src/runtime/c/INSTALL~. + +After a successful ~make install~, rebuild the Python bindings. + +** configure: error: cpu aarch64 not supported + +When building the C runtime, did you get this error? + +#+begin_example + configure: error: cpu aarch64 not supported +#+end_example + +Solution: edit ~src/runtime/c/configure.ac~ to add ~aarch*~ to the ~arm64~ line. + +#+begin_example + aarch* | arm*) cpu=arm; AC_DEFINE(LIGHTNING_ARM, 1, +#+end_example + +** How to re-build the Python bindings using pip + +Sometimes a ~pip install pgf~ will decline to recompile, because a cached wheel exists. + +To return to a more pristine state, + +#+begin_example + pip uninstall pgf + pip cache remove pgf +#+end_example + +You may need to ~sudo~ some of the above commands. + +Then you can repeat + +#+begin_example + $ EXTRA_INCLUDE_DIRS=/usr/local/include EXTRA_LIB_DIRS=/usr/local/lib pip install pgf +#+end_example + +** How to re-build the Python bindings manually + +If the ~pip install pgf~ just isn't working, try building it directly in ~gf-core/src/runtime/python~: + +#+begin_example + $ python setup.py build + $ sudo python setup.py install +#+end_example + +You may need to add the ~EXTRA~ environment prefixes as shown in previous commands. + From b53a102c98ec9693a5cbecb9ade08bc1a1d07742 Mon Sep 17 00:00:00 2001 From: Meng Weng Wong Date: Fri, 25 Feb 2022 14:56:50 +0800 Subject: [PATCH 08/17] if this PR is accepted we don't need these instructions --- src/runtime/python/README.org | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/runtime/python/README.org b/src/runtime/python/README.org index 8885694b5..86584dc01 100644 --- a/src/runtime/python/README.org +++ b/src/runtime/python/README.org @@ -120,20 +120,6 @@ Build the C runtime by following the instructions in ~gf-core/src/runtime/c/INST After a successful ~make install~, rebuild the Python bindings. -** configure: error: cpu aarch64 not supported - -When building the C runtime, did you get this error? - -#+begin_example - configure: error: cpu aarch64 not supported -#+end_example - -Solution: edit ~src/runtime/c/configure.ac~ to add ~aarch*~ to the ~arm64~ line. - -#+begin_example - aarch* | arm*) cpu=arm; AC_DEFINE(LIGHTNING_ARM, 1, -#+end_example - ** How to re-build the Python bindings using pip Sometimes a ~pip install pgf~ will decline to recompile, because a cached wheel exists. From 20453193fe0a5bd4cfa1c506674e2d5a297e318d Mon Sep 17 00:00:00 2001 From: Meng Weng Wong Date: Sun, 20 Feb 2022 22:15:32 +0800 Subject: [PATCH 09/17] add compilation support for ghc 9.0.2 --- gf.cabal | 14 +++++++------- stack-ghc9.0.2.yaml | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 stack-ghc9.0.2.yaml diff --git a/gf.cabal b/gf.cabal index b4dcf81a0..c8386d3a8 100644 --- a/gf.cabal +++ b/gf.cabal @@ -11,7 +11,7 @@ description: GF, Grammatical Framework, is a programming language for multilingu maintainer: John J. Camilleri homepage: https://www.grammaticalframework.org/ bug-reports: https://github.com/GrammaticalFramework/gf-core/issues -tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.10.4 +tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.10.4, GHC==9.0.2 data-dir: src extra-source-files: @@ -46,7 +46,7 @@ data-files: custom-setup setup-depends: - base >= 4.9.1 && < 4.15, + base >= 4.9.1 && < 4.16, Cabal >= 1.22.0.0, directory >= 1.3.0 && < 1.4, filepath >= 1.4.1 && < 1.5, @@ -81,11 +81,11 @@ library build-depends: -- GHC 8.0.2 to GHC 8.10.4 array >= 0.5.1 && < 0.6, - base >= 4.9.1 && < 4.15, + base >= 4.9.1 && < 4.16, bytestring >= 0.10.8 && < 0.11, containers >= 0.5.7 && < 0.7, exceptions >= 0.8.3 && < 0.11, - ghc-prim >= 0.5.0 && < 0.7, + ghc-prim >= 0.5.0 && < 0.7.1, mtl >= 2.2.1 && < 2.3, pretty >= 1.1.3 && < 1.2, random >= 1.1 && < 1.3, @@ -302,14 +302,14 @@ library build-depends: cgi >= 3001.3.0.2 && < 3001.6, httpd-shed >= 0.4.0 && < 0.5, - network>=2.3 && <2.7 + network>=2.3 && <3.2 if flag(network-uri) build-depends: network-uri >= 2.6.1.0 && < 2.7, - network>=2.6 && <2.7 + network>=2.6 && <3.2 else build-depends: - network >= 2.5 && <2.6 + network >= 2.5 && <3.2 cpp-options: -DSERVER_MODE other-modules: diff --git a/stack-ghc9.0.2.yaml b/stack-ghc9.0.2.yaml new file mode 100644 index 000000000..17eb5c855 --- /dev/null +++ b/stack-ghc9.0.2.yaml @@ -0,0 +1,14 @@ +resolver: nightly-2022-02-19 + +extra-deps: +# - network-2.6.3.6 +# - httpd-shed-0.4.0.3 +# - cgi-3001.5.0.0@sha256:3d1193a328d5f627a021a0ef3927c1ae41dd341e32dba612fed52d0e3a6df056,2990 +# - json-0.10@sha256:d9fc6b07ce92b8894825a17d2cf14799856767eb30c8bf55962baa579207d799,3210 +# - multipart-0.2.0@sha256:b8770e3ff6089be4dd089a8250894b31287cca671f3d258190a505f9351fa8a9,1084 + +# flags: +# gf: +# c-runtime: true +# extra-lib-dirs: +# - /usr/local/lib From b762e24a821a03ccdf66dbb1ddd213debbb1f41b Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sat, 5 Mar 2022 13:25:26 +0800 Subject: [PATCH 10/17] Add ghc-9.0.2 to CI --- .github/workflows/build-all-versions.yml | 2 +- stack-ghc9.0.2.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-all-versions.yml b/.github/workflows/build-all-versions.yml index 445493065..ecbcfff99 100644 --- a/.github/workflows/build-all-versions.yml +++ b/.github/workflows/build-all-versions.yml @@ -66,7 +66,7 @@ jobs: strategy: matrix: stack: ["latest"] - ghc: ["7.10.3","8.0.2", "8.2.2", "8.4.4", "8.6.5", "8.8.4", "8.10.7"] + ghc: ["7.10.3","8.0.2", "8.2.2", "8.4.4", "8.6.5", "8.8.4", "8.10.7", "9.0.2"] # ghc: ["8.8.3"] steps: diff --git a/stack-ghc9.0.2.yaml b/stack-ghc9.0.2.yaml index 17eb5c855..bdfeca742 100644 --- a/stack-ghc9.0.2.yaml +++ b/stack-ghc9.0.2.yaml @@ -1,4 +1,4 @@ -resolver: nightly-2022-02-19 +resolver: nightly-2022-02-19 # ghc 9.0.2 extra-deps: # - network-2.6.3.6 From 862aeb5d9bbd04feade6dccef3a98e3187f89999 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sat, 5 Mar 2022 13:41:45 +0800 Subject: [PATCH 11/17] Update base <4.15 to <4.16 for tests + pgf*.cabal --- gf.cabal | 2 +- src/runtime/haskell-bind/pgf2.cabal | 2 +- src/runtime/haskell/pgf.cabal | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gf.cabal b/gf.cabal index c8386d3a8..53548cd40 100644 --- a/gf.cabal +++ b/gf.cabal @@ -400,7 +400,7 @@ test-suite gf-tests main-is: run.hs hs-source-dirs: testsuite build-depends: - base >= 4.9.1 && < 4.15, + base >= 4.9.1 && < 4.16, Cabal >= 1.8, directory >= 1.3.0 && < 1.4, filepath >= 1.4.1 && < 1.5, diff --git a/src/runtime/haskell-bind/pgf2.cabal b/src/runtime/haskell-bind/pgf2.cabal index 1d5f61991..83c990bf3 100644 --- a/src/runtime/haskell-bind/pgf2.cabal +++ b/src/runtime/haskell-bind/pgf2.cabal @@ -26,7 +26,7 @@ library PGF2.Expr, PGF2.Type build-depends: - base >= 4.9.1 && < 4.15, + base >= 4.9.1 && < 4.16, containers >= 0.5.7 && < 0.7, pretty >= 1.1.3 && < 1.2 default-language: Haskell2010 diff --git a/src/runtime/haskell/pgf.cabal b/src/runtime/haskell/pgf.cabal index 41e67f6ae..cb5841a1c 100644 --- a/src/runtime/haskell/pgf.cabal +++ b/src/runtime/haskell/pgf.cabal @@ -15,7 +15,7 @@ library default-language: Haskell2010 build-depends: array >= 0.5.1 && < 0.6, - base >= 4.9.1 && < 4.15, + base >= 4.9.1 && < 4.16, bytestring >= 0.10.8 && < 0.11, containers >= 0.5.7 && < 0.7, ghc-prim >= 0.5.0 && < 0.7, From 221597bd79054af47d3d5866d74a03ee9d7cd6e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Mon, 11 Oct 2021 10:33:43 +0800 Subject: [PATCH 12/17] When profiling, don't add cost centres in Data.Binary.Get This change speeds up profiling by an order of magnitude. Without it, the >>= function for Get dominates runtime completely during profiling. --- src/runtime/haskell/Data/Binary/Get.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/runtime/haskell/Data/Binary/Get.hs b/src/runtime/haskell/Data/Binary/Get.hs index 54f17ae95..07a3db40e 100644 --- a/src/runtime/haskell/Data/Binary/Get.hs +++ b/src/runtime/haskell/Data/Binary/Get.hs @@ -1,4 +1,6 @@ {-# LANGUAGE CPP, MagicHash #-} +-- This module makes profiling a lot slower +{-# OPTIONS_GHC -fno-prof-auto #-} -- for unboxed shifts ----------------------------------------------------------------------------- From b0b2a06f3b3485e41ebfb66c2d4ebbd5dd8e6119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Tue, 3 May 2022 13:10:29 +0800 Subject: [PATCH 13/17] Improve comment --- src/runtime/haskell/Data/Binary/Get.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/haskell/Data/Binary/Get.hs b/src/runtime/haskell/Data/Binary/Get.hs index 07a3db40e..895789061 100644 --- a/src/runtime/haskell/Data/Binary/Get.hs +++ b/src/runtime/haskell/Data/Binary/Get.hs @@ -1,5 +1,5 @@ {-# LANGUAGE CPP, MagicHash #-} --- This module makes profiling a lot slower +-- This module makes profiling a lot slower, so don't add automatic cost centres {-# OPTIONS_GHC -fno-prof-auto #-} -- for unboxed shifts From e6ade90679e53e793cbe3cf0d526f11754d4b3d2 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 6 May 2022 08:45:12 +0800 Subject: [PATCH 14/17] update nightly to latest lts --- stack-ghc9.0.2.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack-ghc9.0.2.yaml b/stack-ghc9.0.2.yaml index bdfeca742..c8f88a134 100644 --- a/stack-ghc9.0.2.yaml +++ b/stack-ghc9.0.2.yaml @@ -1,4 +1,4 @@ -resolver: nightly-2022-02-19 # ghc 9.0.2 +resolver: lts-19.6 extra-deps: # - network-2.6.3.6 From 9b9905c0b27c59c1dd49cdfdfb6b14dddc8f77d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Wed, 18 May 2022 14:42:01 +0800 Subject: [PATCH 15/17] Always use UTF8 encoding in the gf executable This fixes many of the "Invalid character" messages you can get on different platforms. This has helped both with a nix-installation that didn't have global locale set and with a windows installation. --- src/compiler/GF/Main.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/GF/Main.hs b/src/compiler/GF/Main.hs index 7d4500c7b..1b90430d6 100644 --- a/src/compiler/GF/Main.hs +++ b/src/compiler/GF/Main.hs @@ -16,6 +16,7 @@ import Data.Version import System.Directory import System.Environment (getArgs) import System.Exit +import GHC.IO.Encoding -- import GF.System.Console (setConsoleEncoding) -- | Run the GF main program, taking arguments from the command line. @@ -23,6 +24,7 @@ import System.Exit -- Run @gf --help@ for usage info. main :: IO () main = do + setLocaleEncoding utf8 -- setConsoleEncoding uncurry mainOpts =<< getOptions From e33de168fd5b2ec27cfb7bc55da0e0ee39d481ac Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 31 May 2022 07:44:25 +0200 Subject: [PATCH 16/17] use a relative link to WordNet --- src/www/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/www/index.html b/src/www/index.html index c660d4055..425c134ef 100644 --- a/src/www/index.html +++ b/src/www/index.html @@ -22,7 +22,7 @@ (bilingual document editor)
  • Word inflection with smart paradigms -
  • GF WordNet (an online browser and editor for the WordNet lexicon)
  • +
  • GF WordNet (an online browser and editor for the WordNet lexicon)
  • Documentation

    From b7672b67a39fb46f3ba8dbacca96babb04fca82c Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 31 May 2022 10:15:50 +0200 Subject: [PATCH 17/17] adjust the -view command depending on the OS --- src/compiler/GF/Command/Commands.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index 2f2e802e0..a6c66594f 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -4,6 +4,7 @@ module GF.Command.Commands ( options,flags, ) where import Prelude hiding (putStrLn,(<>)) -- GHC 8.4.1 clash with Text.PrettyPrint +import System.Info(os) import PGF @@ -882,11 +883,15 @@ pgfCommands = Map.fromList [ Right ty -> ty Nothing -> error ("Can't parse '"++str++"' as a type") optViewFormat opts = valStrOpts "format" "png" opts - optViewGraph opts = valStrOpts "view" "open" opts + optViewGraph opts = valStrOpts "view" open_cmd opts optNum opts = valIntOpts "number" 1 opts optNumInf opts = valIntOpts "number" 1000000000 opts ---- 10^9 takeOptNum opts = take (optNumInf opts) + open_cmd | os == "linux" = "xdg-open" + | os == "mingw32" = "start" + | otherwise = "open" + returnFromExprs es = return $ case es of [] -> pipeMessage "no trees found" _ -> fromExprs es @@ -1022,4 +1027,4 @@ stanzas = map unlines . chop . lines where #if !(MIN_VERSION_base(4,9,0)) errorWithoutStackTrace = error -#endif \ No newline at end of file +#endif