pointless
pointless copied to clipboard
Add very simple installation procedure
It's not much, but this does make it so that users can make && sudo make install
and end up with a functioning pointless
binary ready to be run from anywhere. I went with /usr/share
as the default location for the prelude since this is where many programs put their "extraneous" files that are nonetheless very good to have. I'm afraid I don't know the second thing about how this stuff works on Windows, so don't feel the need to merge this one.
In fact, I much prefer your idea of directly incorporating the prelude bytecode into the executable, but that sounds like a fairly tall order to my ears. If you think that's a long way out, it might be worth "starting from scratch" with something like the GNU Autotools, but the cleanliness of the build would certainly go away with that option.
I tried to keep it so simple that It Just Works™, but I've had that bite before. Up to you, of course.
I was thinking a little about this, I'm not sure how the Linux story goes, but for macOS most software likes to sit in /usr/local
. In fact, AFAIK you can't even write to /usr/share
. Is there a portable way that would run on both OS's?
You probably do want /usr/local
, as /usr
is typically for packages installed by the OS's package manager. From http://www.pathname.com/fhs/pub/fhs-2.3.html#USRLOCALLOCALHIERARCHY:
The /usr/local hierarchy is for use by the system administrator when installing software locally.
I usually see something like this at the top of Makefiles:
PREFIX ?= /usr/local
_INSTDIR = $(DESTDIR)$(PREFIX)
BINDIR ?= $(_INSTDIR)/bin
SHAREDIR ?= $(_INSTDIR)/share
LIBDIR ?= $(SHAREDIR)/pointless
MANDIR ?= $(SHAREDIR)/man
Then to install:
.PHONY: install
install:
mkdir -p $(BINDIR) $(LIBDIR) $(MANDIR)/man1
install -m755 pointless $(BINDIR)/pointless
install -m644 lib $(LIBDIR)
install -m644 doc/pointless.1 $(MANDIR)/man1/pointless.1
This lets you do make PREFIX=/what/ever install
or even make DESTDIR=. install
.
For example, the scdoc Makefile: https://git.sr.ht/~sircmpwn/scdoc/tree/master/Makefile
I appreciate the help - this installation stuff is pretty new to me (I didn't know you could pass definitions into a C file from make!). I'll accept the pull request as soon as I can update the installation documentation to reflect the change.
I'm looking into this again now that Pointless v0.1.0 is able to a little more flexible with regards to the location of the interpreter binary - the binary still looks for the prelude files using a relative path, so it needs to keep its location relative to these files, but it can now be called from any directory.
You could update lib/src/source.dart
to look for the prelude files in /usr/share
- but it seems like this would break development for those who want to use Pointless locally. Is there some way to balance these two use-cases?