eisl
eisl copied to clipboard
Enhancement request: Default library directory should be hardcoded at compilation time
It's common for Lisp/Scheme implementations to use configure/make scripts to tell where the library directory is. CHICKEN Scheme for example generates chicken-defaults.h
containing this information. It can then be used from the C source code and exposed to the Scheme bits. This way users wouldn't need to set EASY_ISLISP
, but can still set it for development purposes.
The logic would look roughly as follows:
- Define something like
LIBDIR ?= $(PREFIX)/share/eisl/library
inmakefile
- Echo
$(LIBDIR)
into a header file - Include the header file into
main.c
- Consult the value of the environment variable
EASY_ISLISP
if set - Otherwise fall back to the default library directory
Bonus: Get rid of the fallback code intended for the developer's personal machine.
It's difficult for me. Mr. Poldy, please advise.
Ok, I opened a pull request. Any feedback is welcome.
Thank you, Mr. Poldy.
Thank you, but this doesn't work as expected. For starters, I get errors when building with both PREFIX
and DESTDIR
set to non-standard values (/usr
and /home/wasa/code/misc/pkgbuilds/eisl-git/pkg/eisl-git
). This is resolved with the following change to makefile
:
From 99a739e19fbf517a715e41617f9ce4b76dbb4adb Mon Sep 17 00:00:00 2001
From: Vasilij Schneidermann <[email protected]>
Date: Thu, 25 Aug 2022 14:36:07 +0200
Subject: [PATCH] Introduce libdir
---
makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/makefile b/makefile
index 32aeafe..9f0980e 100644
--- a/makefile
+++ b/makefile
@@ -72,6 +72,7 @@ PREFIX := /usr/local
LIBDIR ?= $(PREFIX)/share/eisl/library
CFLAGS += -DLIBDIR='"$(LIBDIR)"'
bindir := $(PREFIX)/bin
+libdir := $(PREFIX)/share/eisl/library
DESTDIR :=
INSTALL := install
INSTALL_PROGRAM := $(INSTALL) -m755
@@ -123,8 +124,8 @@ install: eisl edlis
$(MKDIR_PROGRAM) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) eisl $(DESTDIR)$(bindir)/$(EISL)
$(INSTALL_PROGRAM) edlis $(DESTDIR)$(bindir)/$(EDLIS)
- $(MKDIR_PROGRAM) $(LIBDIR)
- $(INSTALL_PROGRAM) library/* $(LIBDIR)
+ $(MKDIR_PROGRAM) $(DESTDIR)$(libdir)
+ $(INSTALL_PROGRAM) library/* $(DESTDIR)$(libdir)
.PHONY: uninstall
uninstall:
--
2.37.1
The other is that if DLIBDIR were /usr/share/eisl/library
, this would still be not correct because the code looks for a library
directory inside that directory, so it would need to be /usr/share/eisl
instead. The quoting bit is ugly, it should instead use #
syntax. I'm working on a PR to fix these outstanding issues.