Bug 236805

Summary: [NEW PORT] lang/elm: Delightful language for reliable webapps
Product: Ports & Packages Reporter: Geoffroy Lorieux <glorieux>
Component: Individual Port(s)Assignee: freebsd-haskell (Nobody) <haskell>
Status: Closed FIXED    
Severity: Affects Only Me CC: arrowd, contact, glorieux, kamila, swills, w.schwarzenfeld
Priority: --- Keywords: needs-patch, needs-qa
Version: LatestFlags: koobs: maintainer-feedback? (glorieux)
Hardware: Any   
OS: Any   
See Also: https://github.com/elm/compiler/issues/1892
Attachments:
Description Flags
Port shar file
none
elm.shar
none
elm-lang.shar -- fixed to build under Poudriere with network, but still doesn't build by default
glorieux: maintainer-approval+
lang/elm - 0.19 - poudriere no network needed
none
lang/elm - 0.19 - poudriere no network needed none

Description Geoffroy Lorieux 2019-03-26 14:52:06 UTC
Port of the elm programming language. https://elm-lang.org

The patch applied before compiling elm comes from the following discussion: https://github.com/elm/compiler/issues/1892
Comment 1 Geoffroy Lorieux 2019-03-26 14:52:46 UTC
Created attachment 203163 [details]
Port shar file
Comment 2 Walter Schwarzenfeld 2019-03-26 14:58:44 UTC
bin/elm would conflict with mail/elm.
Comment 3 Walter Schwarzenfeld 2019-03-26 15:00:15 UTC
And for one file you need no pkg-plist. You can put it under PLIST_FILES in the Makefile.
Comment 4 Steve Wills freebsd_committer freebsd_triage 2019-05-26 23:55:49 UTC
This fails to build for me, I think because it tries to fetch during the build.
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2019-05-28 03:43:07 UTC
COMMENT needs the leading indefinite article ("A ") removed, and port needs confirmation of QA passing (portlint, poudriere)
Comment 6 Geoffroy Lorieux 2019-05-29 09:35:08 UTC
Created attachment 204689 [details]
elm.shar
Comment 7 Geoffroy Lorieux 2019-05-29 09:36:50 UTC
Comment on attachment 204689 [details]
elm.shar

Removes the plist file and fixes COMMENT.
Comment 8 Kamila Součková 2019-06-05 10:53:33 UTC
Created attachment 204835 [details]
elm-lang.shar -- fixed to build under Poudriere with network, but still doesn't build by default

I made small changes to the port, so that it at least builds under Poudriere with ALLOW_NETWORKING_PACKAGES="elm-lang" (previously it did not, as cabal was trying to write to a non-existent directory). This way it can at least be built, and afterwards the packaged binary works as expected.

Me and Evilham (subscribed) spent quite a bit of effort trying to make this build without network, but we were not successful. The reason is that the Haskell bits are throwing logs under our feet: cabal does not actually really resolve dependencies until it tries to build things. Therefore, moving fetching of dependencies into the fetch part without also moving the build itself there doesn't work.

The workaround used in other Haskell packages is to manually figure out the right dependencies and use the substantial machinery in Mk/Uses/cabal.mk. This is, unfortunately, also not quite usable, because cabal.mk assumes that the package in question is on Hackage, which Elm is not (well it is, but it is very much out of date). Evilham might be able to provide more details on this. I believe that the best way to make a "proper" port out of this would be to update the Elm package on Hackage, and do it the cabal.mk way.

Would the elm people be willing to add up-to-date Elm to Hackage? If yes, we could ask the FreeBSD Haskell folks for help and hopefully make this work and  get it committed.
Comment 9 Evilham 2019-07-14 19:07:10 UTC
Created attachment 205773 [details]
lang/elm - 0.19 - poudriere no network needed

Managed to do the job to make this build under poudriere without a need for network; thanks to arrowd for all the useful pointers.
(Build log for quick reference, URL valid for 30 days: https://termbin.com/0d73)


As I mentioned over at #haskell-freebsd, there is an interesting question about the language versions, e.g. right now it would be useful (though not necessary) to have both elm 0.18 and elm 0.19, in a few months/years though, when there is a new version of elm, we will likely want to be able to install the new one and 0.19 side-by-side, which can prove tricky if the port is just "elm" with version 0.19.0.

An option would be to do something like what python does: elm018 (old, but used), elm019 (current), elm${VERSION} (future).

That raises the question of the name for the executables, I'd incline right now towards having elm for the current version and elm018 for the old one.

If provided guidance I'd be willing to help make that happen in a way that works out long-term, giving priority to getting the elm019 in shape to be added.


Then, with so many people having touched this port, there is also the implicit question of the maintainer metadata, I left it at haskell@FreeBSD.org and subscribed to the ML as I guess that'd be mostly non controversial.

Thank you in advance for any input you may have!
Comment 10 Gleb Popov freebsd_committer freebsd_triage 2019-07-14 19:58:49 UTC
(In reply to Evilham from comment #9)
Good job on making the port!

From a quick glance, I have one nitpick - you probably don't need to have

EXECUTABLES=	elm

in the Makefile, as it defaults to ${PORTNAME}.

Hvae you tried actually compiling something using elm? Some Haskell packages require data files to be installed too, so it's better to try running it.

I will try to compile your port in poudriere soon.
Comment 11 Evilham 2019-07-14 20:32:54 UTC
(In reply to Gleb Popov from comment #10)

Indeed it works without EXECUTABLES as well, it was a left over from having named the port elm-lang at first.

I probably should have mentioned that I built the elm-lang.org website with the binary package that was produced on poudriere as well as other sources and it worked just fine.


Meanwhile I was taking a look at elm-0.18, it looks like that was a bit of a mess with multiple binaries from multiple repositories and an awkward build chain, so it may not be worth the time investment right now.

arrowd mentioned that switching in the future to a master port / slave ports for the different versions wouldn't be too problematic, so maybe it'd be OK if we left lang/elm as the one and only elm port until a new version is released (which apparently can take anything from some months to some years) or someone (could be future me in some months) does the work to get 0.18 to compile properly.
Comment 12 Evilham 2019-07-14 20:37:46 UTC
Created attachment 205779 [details]
lang/elm - 0.19 - poudriere no network needed

Removed unnecessary EXECUTABLES in Makefile.
Comment 13 commit-hook freebsd_committer freebsd_triage 2019-07-15 18:58:33 UTC
A commit references this bug:

Author: arrowd
Date: Mon Jul 15 18:58:10 UTC 2019
New revision: 506703
URL: https://svnweb.freebsd.org/changeset/ports/506703

Log:
  lang/elm: new port. A functional language for web development.

  PR:		236805
  Submitted by:	Evilham <contact@evilham.com>

Changes:
  head/lang/Makefile
  head/lang/elm/
  head/lang/elm/Makefile
  head/lang/elm/distinfo
  head/lang/elm/files/
  head/lang/elm/files/patch-elm.cabal
  head/lang/elm/files/patch-ui_terminal_src_Develop_StaticFiles.hs
  head/lang/elm/pkg-descr
Comment 14 Gleb Popov freebsd_committer freebsd_triage 2019-07-15 19:00:16 UTC
Thanks everyone involved in creating a port.