Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Nov 2013 15:17:26 +0100
From:      Marc van Woerkom <marc.vanwoerkom@gmail.com>
To:        freebsd-ports@freebsd.org
Subject:   Need advice on porting an Erlang application (Zotonic CMS)
Message-ID:  <CAF_qSm45dxdtf85YHP8R-UXroV=KXigH-DJoXkvnhLYL2U-2ZQ@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Note: I posted this first in the google group, but it seems a post there
won't reach the mailing list

Hello,

I am trying to port Zotonic, a CMS and web framework written in Erlang.

  https://github.com/mvw/freebsd-ports-www-zotonic


So far it is mainly used on Linux systems, where one unpacks a zip archive
with a release or clone the git repo of the project in some working
directory.

One then runs a GNU make in that directory which calls rebar, a build
system written in Erlang which strives to organize the application
according to the rules of the Erlang/OTP platform.

One ends up with that aforementioned working directory, populated by
scripts, resource data, Erlang sources and beam files (compiled Erlang).

The application is then managed (start/stop/status..) by using a control
script.


To make this work under FreeBSD, I need to find a healthy compromise
beetween the FreeBSD standards (as written down in the FreeBSD Porter's
Handbook and the hier(7) man page) and the directory layout assumed by
Erlang/OTP and rebar, modulo some differences between the Linux and FreeBSD
operating systems.

The present state of the port does well with the fetch, extract, patch and
make targets. I am now grappling with the stage and install targets.


It is possible to run Zotonic from the www/zotonic/work directory, because
that fits the directory layout assumptions of the original rebar based
system, which does everything (configure/build/run) in the unpack work
directory.

I now plan to pick up all relevant files and sort them into the directories
according to hier(7) and then make things run there, which is likely to
need some patches, because some sub directory trees are moved relatively to
the the unpack work directory.

This approach seems to lead to a large Makefile:


https://github.com/mvw/freebsd-ports-www-zotonic/blob/master/zotonic/Makefile

I end up manually mapping the directory tree into NSTALL_DATA,
INSTALL_SCRIPT,
INSTALL_PROGRAM statements in the Makefile.
I am tempted to write a helper script for this, as this involves a large
set of files. It will also result in a long pkg-plist.

This is ugly work and with the next zotonic release, I can do it all over
again.

Do I need to go this road, or do you folks know a better approach?

For example I was tempted to simply copy the stuff from work/zotonic to
usr/local/lib/erlang/lib/
zotonic-x.y during the make install target and then start the rebar stuff
in the post-install phase, which would lead to Erlang compilations after
the make phase (bah!), but would probably make my life easier. But doing
this with a plan ${CP} would not fix the messy permission bits and
ownerships from the original zip archive.

Glad for any comment,
Marc



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAF_qSm45dxdtf85YHP8R-UXroV=KXigH-DJoXkvnhLYL2U-2ZQ>