sasagawa888 / eisl

ISLisp interpreter/compiler
Other
272 stars 22 forks source link

Enhancement request: Default library directory should be hardcoded at compilation time #199

Closed wasamasa closed 2 years ago

wasamasa commented 2 years ago

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:

Bonus: Get rid of the fallback code intended for the developer's personal machine.

sasagawa888 commented 2 years ago

It's difficult for me. Mr. Poldy, please advise.

poldy commented 2 years ago

Ok, I opened a pull request. Any feedback is welcome.

sasagawa888 commented 2 years ago

Thank you, Mr. Poldy.

wasamasa commented 2 years ago

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 <mail@vasilij.de>
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.