Commit graph

56 commits

Author SHA1 Message Date
pho
ea7c21bc21 mk/haskell.mk (HASKELL_UNRESTRICT_DEPENDENCIES): Tighten the regex futher to avoid unintended matches 2023-10-29 07:51:22 +00:00
pho
2e73b61c12 mk/haskell.mk: Narrow the pattern to conditionalize Haddock documentation files in PRINT_PLIST_AWK
We were previously conditionalizing everything under share/doc, which was
incorrect because packages could also install LICENSE files there.
2023-10-09 05:30:01 +00:00
pho
7fde0f7e5c mk/haskell.mk: Change the compiler from lang/ghc92 to lang/ghc94 2023-02-01 03:37:21 +00:00
pho
c0a3392847 mk/haskell.mk: Tighten the regex for HASKELL_UNRESTRICT_DEPENDENCIES to prevent unintended substitutions 2023-01-30 11:09:42 +00:00
pho
3d03ad8941 mk/haskell.mk: New package-settable variable HASKELL_ENABLE_TESTS, disabled by default
It turned out to be a bad idea to define a do-test target
unconditionally. Tests can only be run when they are built, but they
usually require additional dependencies so it can't be enabled by default.
2023-01-24 11:57:09 +00:00
pho
f1bb9bc3d2 mk/haskell.mk: Do not define the target "do-test" if it's already there, suggested by riastradh@ 2023-01-24 04:50:24 +00:00
pho
ad254c6f9b mk/haskell.mk: Improve the regex for HASKELL_UNRESTRICT_DEPENDENCIES 2023-01-24 04:28:28 +00:00
pho
930668b03c mk/haskell.mk: Fix typos in a comment 2022-09-08 15:18:48 +00:00
pho
1b1b2d0e99 mk/haskell.mk: print-PLIST: Prefix optionally-built files with ${PLIST.*}
HASKELL_ENABLE_SHARED_LIBRARY, HASKELL_ENABLE_LIBRARY_PROFILING, and
HASKELL_ENABLE_HADDOCK_DOCUMENTATION are user-settable variables that can
affect the set of installed files. `make print-PLIST' should automatically
handle these.
2022-09-08 07:38:50 +00:00
wiz
9b7700dc28 mk: fix typos in comments 2022-09-08 05:26:16 +00:00
pho
f3c66a03f9 mk/haskell.mk: New package-settable variable "HASKELL_UNRESTRICT_DEPENDENCIES"
It's a list of Cabal package names whose version constraints need to be
relaxed. This should free ourselves from needing to patch *.cabal files
most of the time. Suggested by wiz@
2022-09-08 04:45:44 +00:00
pho
da3b3ca71f mk/haskell.mk: Improve `show-all-haskell' outputs 2022-09-08 03:42:10 +00:00
wiz
c532f0bdab mk/haskell.mk: remove pkg-config hiding workaround
pkg-config is now hidden by default if not in USE_TOOLS
2022-07-23 07:14:54 +00:00
pho
555de7c535 mk/haskell.mk: Enable --enable-split-sections
Ask GHC to put each compiled function in a separate section and ld(1) to
perform GC. This greatly reduces the size of executables linked with static
Haskell libraries. For example, lang/purescript shrinks down from 104 MiB
to 57 MiB! Reduced storage use means reduced I/O cost!
2022-02-26 03:55:37 +00:00
pho
aad7fd9413 mk/haskell.mk: Add a package-settable variable HASKELL_ENABLE_DYNAMIC_EXECUTABLE
Prior to this change, packages that install both libraries and executables
were both linked dynamically when HASKELL_ENABLE_SHARED_LIBRARY is set to
yes. This turned out to be problematic when the executables end up
depending on hundreds of shared objects (which occurs rather frequently for
tools written in Haskell): the dynamic linker spends several seconds upon
loading the executables to resolve all the symbols.

Now we can selectively opt out from dynamic linkage by setting
HASKELL_ENABLE_DYNAMIC_EXECUTABLE to no. This should be done carefully,
because linking executables with static Haskell libraries means that those
executables will also use static RTS. This causes problems if they use GHC
API to interpret Haskell code at run time: static RTS would violate PaX
MPROTECT and suffer from ASLR while loading static objects.
2022-02-23 16:03:00 +00:00
pho
822826a3f8 mk/haskell.mk: Switch the default Haskell compiler to lang/ghc92 2022-02-12 08:38:15 +00:00
pho
b47b80d798 Wrote a packaging guide for Haskell packages 2022-02-11 05:24:06 +00:00
pho
6bb80a54ac Infrastructure improvements and bugfixes to mk/haskell.mk
* mk/haskell.mk no longer set USE_TOOLS+=pkg-config for all the packages
  that include it. Instead it does TOOLS_FAIL+=pkg-config unless they
  explicitly do USE_TOOLS.

* Fixed an issue regarding Template Haskell and our wrappers.

* Fixed an issue where packages that had things like PLIST.common but
  lacked PLIST were incorrectly considered to have no PLISTs.

* mk/haskell.mk now supports packages that contain more than a single
  library. The INSTALL and DEINSTALL scripts can now handle such packages
  properly.
2022-02-11 01:11:57 +00:00
pho
e6b403f35b Warn when PLIST is missing, not just when it is outdated 2022-02-07 02:58:24 +00:00
pho
db46eea828 Support PKGSRC_MKPIE 2022-01-18 02:24:36 +00:00
nia
7fad5b5799 Disable MKPIE in Haskell.
Presumably there's a way to make this work, but it probably requires
changes to the bootstrap kits.
2021-09-27 14:30:47 +00:00
pho
3c537cb057 Support PKGSRC_USE_RELRO 2021-05-04 15:44:33 +00:00
pho
453fae4479 Switch the default compiler to lang/ghc90 2021-05-02 13:39:25 +00:00
pho
443566c5fb Use tools framework for Haskell source preprocessors 2021-05-01 16:14:19 +00:00
pho
5fba640853 Move lengthy awk and shell scripts out of haskell.mk 2021-05-01 15:06:26 +00:00
pho
56b10e6f5c Fix a bug in my previous commit 2021-05-01 14:24:21 +00:00
pho
aaed0e0c91 Support Cabal packages that lack Setup.?hs
They currently have Setup.hs in ${FILESDIR} with almost always the same
content. We can do better than that.
2021-05-01 14:10:55 +00:00
pho
187301d3fc Rework the PLIST handling to support executable-only packages
It was a long-standing issue that Haskell packages which didn't contain a
library could not be correctly handled.

There are fewer substitutions in PLIST_SUBST now. As a result existing
PLIST files will all be considered as outdated and should be updated
either by setting HS_UPDATE_PLIST=yes or by manually running print-PLIST.
They will be ignored until that.
2021-04-23 03:57:16 +00:00
pho
f369c8d13b mk/haskell.mk: Ignore per-user package environment file while building 'Setup'
Turned out this was necessary when using `cabal-install v2-install` outside of pkgsrc, because the command creates a per-user package environment and in turn makes Cabal hidden.
2021-03-14 08:19:24 +00:00
rillig
7c3702e7d7 mk/haskell.mk: clean up _VARGROUPS section and unused variables 2020-07-01 15:07:25 +00:00
rillig
207c2f13df mk/haskell.mk: remove variable HASKELL_COMPILER, clean up documentation
There was only a single valid value for HASKELL_COMPILER, therefore the
variable was useless.  It only made the implementation more complicated
than necessary.
2020-07-01 14:58:43 +00:00
rillig
ab8c506b0b mk/haskell.mk: regenerate PLIST if it is outdated
Now that haskell.mk distinguishes between plain and outdated PLIST files,
this is possible again.  When haskell.mk knew only missing and outdated,
this was still ambiguous and therefore skipped.
2020-06-29 22:00:58 +00:00
rillig
c8f6fed1ea mk/haskell.mk: fix PLIST status detection
As seen in devel/hs-hashable/PLIST r1.1, which listed only the
package-description but not the package-id.
2020-06-29 20:51:24 +00:00
rillig
a5039d7c3c mk/haskell.mk: only add PLIST_SUBST and PRINT_PLIST_AWK if useful
The PLIST_SUBST and PLIST_PRINT_AWK definitions for Haskell library
packages are only useful if the package-description file exists.  If
that file is absent though, these are skipped.

The test whether the file exists is made as late as possible since that
file does not yet exist at the point where the package Makefile is
parsed.

This also affects the show-all-haskell target, which only shows these
values after the install phase.  This is not perfect but good enough for
practical cases.
2020-06-29 20:30:13 +00:00
rillig
aeff688767 mk/haskell.mk: fix PLIST status detection
Before, running "HS_UPDATE_PLIST=yes bmake update" in wm/xmonad did not
apply the proper substitutions to the generated PLIST file since the
PLIST file was created empty during the GENERATE_PLIST command, and that
empty PLIST file changed the status to "plain" instead of "missing".
Because of that, the HS_INTF and related placeholders were not defined.

The 2 conditions for the status "missing" had to be written in separate
.if clauses because of a bug in bmake that was introduced in 2015 and
will be fixed with the next bmake update.  For further details, see
src/usr.bin/make/unit-tests/cond-short.mk.
2020-06-29 18:07:45 +00:00
rillig
c842ae6257 mk/haskell.mk: fix PLIST generation for Haskell packages
The package textproc/hs-cgrep does not install a Haskell library.  This
was unexpected to mk/haskell.mk, which generated an obviously wrong PLIST
file for that package, and for 3 other packages.

Noticed by wiz.
2020-06-21 22:21:02 +00:00
rillig
3c7198b683 mk/haskell.mk: allow to generate PLIST files
Since GHC 7.10 or 7.8, the Haskell packages are installed in directories
whose name contains the package hash.  This made it harder to predict the
exact pathname.  Havin the exact pathnames in the PLIST file is the
ideal, it also helps to record the general structure of the installed
files to see whether some file unexpectedly appear or disappear.

To enable this for Haskell packages, the various base directories are
replaced with placeholders during print-PLIST.  These placeholders are
translated back to their respective paths when the +PLIST is generated
from the PLIST in the package directory.

Except for 2 packages, all Haskell packages in main pkgsrc had their
package PLIST file removed.  To help in adding them back, the pkgsrc
developer can set HS_UPDATE_PLIST=yes in mk.conf, which will generate the
PLIST directly into ${PKGDIR}/PLIST upon installation.

Most packages in pkgsrc-wip still have their old PLIST, and these are
migrated automatically as well.
2020-05-10 17:46:59 +00:00
riastradh
ea504032f9 Missed a spot -- set MAKE_ENV during haddock build too. 2020-03-30 18:23:48 +00:00
riastradh
270c7f3e7b In Haskell packages, set MAKE_ENV while running ./Setup build. 2020-03-30 17:51:07 +00:00
riastradh
4c01312406 New package variable HASKELL_PKG_NAME.
Used to form _HASKELL_PKG_DESCR_DIR.  Defaults to DISTNAME, but for
some packages (hledger, incoming), the same DISTNAME is shared by
multiple packages.  So let the package define it explicitly if need
be.
2020-03-30 16:51:53 +00:00
joerg
a1e7953bb0 Don't use normal memory size limits with GHC for module builds. 2020-03-24 20:43:17 +00:00
pho
865567336f Build ${WRKSRC}/Setup in the do-configure phase
Doing it in pre-configure makes it unable to do SUBST in that phase.
2020-01-20 14:14:33 +00:00
pho
a1f59741bc Use _MAKE_JOBS_N defined in build/build.mk 2020-01-19 23:45:06 +00:00
pho
9bbb8420be Configurable optimization level and compilation parallelism 2020-01-18 01:39:01 +00:00
pho
024aad2263 Switch from ghc7 to ghc88 2020-01-11 07:47:18 +00:00
pho
ee9f90656c Use hashed package keys for (un)installing Cabal packages
Starting from somewhere around GHC 7.8, Cabal installs packages with a
hashed package key instead of just "{NAME}-{VERSION}". In other words,
the pair of the plain package name and the version is no longer unique
in the package DB, and using it for uninstallation may also remove
packages that we didn't mean to remove.

This is paricularly problematic because GHC comes with several bundled
Cabal packages. Installing and uninstalling a package with the same
name could break GHC itself, if the uninstallation is performed
without hashed keys.
2020-01-09 12:29:32 +00:00
pho
0215d2d16a Be explicit about shared libraries
Recent versions of Cabal appears to build shared libraries by default unless --disable-shared is explicitly given.
2020-01-02 16:45:15 +00:00
pho
f20c406612 Pass -v to ./Setup when PKG_VERBOSE is defined 2020-01-02 16:34:47 +00:00
pho
d3ea0027a2 Suppress an error occurs when buildlink is not present 2020-01-01 04:54:10 +00:00
pho
e8f85a7b71 Remove unused variables 2020-01-01 04:35:29 +00:00