Snapping LDC (LLVM-based D compiler)
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Thu Sep 1 21:52:24 UTC 2016
On 27.08.2016 22:45, Joseph Rushton Wakeling wrote:
> I thought I'd have a go at making a snap of LDC, the LLVM-based compiler for the
> D programming language. I recognize that snapping a compiler might be jumping
> ahead of the current intended use-case(s), but it's fun to see what could be
> possible -- and besides, D's compilers are updated fairly often, so it would be
> great to be able to package them easily in a truly cross-distro form.
OK, a certain amount of wailing and gnashing of teeth later (and following some
great help here and from the LDC devs -- big thanks to all!), I have a
provisional first working setup (as in, at least, "Works For Me").
First, here's my snapcraft.yaml:
https://gist.github.com/WebDrake/6ad7e5fe48abc999460cb67a31972afe
So, put this in a working directory, and run `snapcraft stage`.
Now edit stage/etc/ldc2.conf and replace it with this:
https://gist.github.com/WebDrake/65cb3aaa355ea325af98d58f8ca52e3f
... and run `snapcraft prime`.
Now create a file `prime/bin/gcc.wrapper` with the following contents:
https://gist.github.com/WebDrake/0081628d70b61e271006c9b8fa3454ef
(This is basically the command-gcc.wrapper that would be generated if I were
exposing the gcc command outside the snap, but minus the path-related stuff that
I presume is the objectionable part of using that wrapper.)
Now run `snapcraft snap` to finish things up, install, and ... voilĂ , a working
LDC snap.
So, with something provisionally working, questions:
* anything obvious that I could do better in the general setup?
* is there any way to automate some of the stages of the above,
e.g. the editing of stage/etc/ldc2.conf or the generation of
prime/bin/gcc.wrapper ... ?
For the second point, obviously I could create a makefile or other script to run
things, but I wondered if there was any support in snapcraft itself for running
simple post-stage or post-prime hooks ... ?
Thanks again and best wishes,
-- Joe
More information about the Snapcraft
mailing list