On Tue, 22 Sep 2015, Berend Hasselman wrote:
> On 22 Sep 2015, at 15:04, Allin Cottrell <cottrell(a)wfu.edu>
wrote:
>
> On Tue, 22 Sep 2015, Berend Hasselman wrote: [...]
>
>> It would be nice if there was complete description of what is
>> needed to build Gretl quartz on OS X. Inspecting the package
>> contents and doing some "otool -L …" magic building gretl-quartz
>> seems to be quite involved.
>
> I could have a go at that. Would it be more useful to have an
> account of building gretl as an App bundle (with all needed
> libraries bundled in), or just as an "ordinary program"? Also,
> when considering the various third-party libraries that are
> needed, do you have any thoughts on Macports vs Homebrew vs plain
> old do-it-yourself?
I would describe how to build the complete App bundle and make the
package for distribution; both the Quartz version and the X11
version. I assume you are building the whole thing in a
do-it-yourself way and using clang (and gfortran? if yes which
one?). It’s just nice to have an account for the “just in case”
scenario.
I have never used/use MacPorts or Homebrew. I always seem to read
about problems and issues and they are not “Mac-ish”. So I keep
away from these. I don’t know if anyone is using Macports or
Homebrew.
You're probably right, best to avoid MacPorts and Homebrew. As you
assume, I'm following the do-it-yourself approach (and using what's
supplied with OS X itself as far as possible).
Everything needed is then in the bundle and if I or someone else
needs the command line version of gretl or gnuplot making a script
to access those two wouldn’t be too difficult. I’m certainly going
to try making two scripts for accessing gretlcli and gnuplot from
a Terminal. I would be able to get rid of your GTK+ framework and
the Aquaterm.framework.
I appreciate your hard work in building a Quartz version of Gretl
and a WXT terminal for gnuplot. The Quartz version is much nicer
than an X-windows version. I don’t use them daily; only once in a
while. Very nice to have (both of them).
Thanks, Berend. Here's a first stab at an outline (more to follow).
For now, I can offer a quick overview of a build process for
Gretl.app. (I should be able to follow up with actual scripts, but
it'll take a while to convert these from my cross-versions to
native, and to test them on a Mac.)
The overall strategy is: (1) create suitable trees in which (a) to
build things and (b) to install things; (2) build a few required
tools if they're not already on your system; (3) build and install
the needed third-party libraries; (4) build and install gretl.
In a bit more detail:
(1) Start by creating a directory tree to hold the app bundle, as in
sudo mkdir -p /Applications/Gretl.app/Contents/Resources
sudo mkdir /Applications/Gretl.app/Contents/MacOS
You could choose some location other than /Applications as the
target, but in that case all binaries, dylibs and .so modules will
probably have to be retargeted using install_name_tool. (Although
that's not a big deal with a clever shell script.)
Also create a tree under your $HOME for storing sources and building
stuff. Just for example:
mkdir -p ~/gretl-build/sources
(2) Tools: you'll need (besides the Xcode command-line tools) a
downloader (curl would do, though I prefer wget), an extractor for
xz files such as unxz, pkg-config, and GNU gettext.
At this point a strategic decision is required: do you want to build
something closely resembling the Gretl.app that we distribute, or
would you like to build an "all-in-one" kit which you could pass on
to other people, hence enabling them to build gretl from source?
In the former case you'd install the tools outside of Gretl.app
(probably in /usr/local or somewhere under /opt); in the latter
case, you could install them into the bundle filespace. But note
that gettext is a special case: it comprises both build tools and a
library, libintl.dylib, that's needed inside the app bundle. If you
install gettext outside of the app (as I do) you then have to copy
libintl into the bundle and "fix it up" with install_name_tool.
(3) Dependencies, not provided by OS X: these include GMP, MPFR,
fftw3, libpng, readline, the complete GLib/GTK stack with pango and
cairo, gtksourceview and gtkmacintegration. You build these and
install them into the app bundle tree. That means that when running
their configure scripts you specify as --prefix
/Applications/Gretl.app/Contents/Resources
or wherever else you chose at step (1).
(Alternatively, you can install them elsewhere, then copy everything
that's actually needed into the app bundle tree, but that's a good
deal more fiddly.)
Note that a fair number of the gretl's dependencies are,
fortunately, supplied by OS X, for example zlib, libxml2, libiconv
and libcurl. Everything you, as builder, need for these libraries
should be provided by the appropriate Xcode SDK, and everything the
end-user needs should be provided by the OS itself.
(4) If all has gone well to this point, it should be possible to
configure the gretl sources to install into Gretl.app, build and
install.
There's no need for a fortran compiler unless you want to in
addition to build X12A (or X13AS nowadays) or TRAMO/SEATS.
As I said, I'll try to follow up with actual scripts (with
configuration details) plus specification of package versions and a
few patches for certain third-party libraries.
Allin