Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running L from outside the path where it was built leads to issues #6

Open
HalosGhost opened this issue Apr 20, 2016 · 1 comment
Open

Comments

@HalosGhost
Copy link

Even when $PREFIX has been set correctly, if L is moved outside its build-tree, it does not function properly.

Namely, it seems to fail to find the L-specific libl.tcl library needed to operate properly.

Running strings, we get the following

$ strings L | grep tcl8.6
../.././L/lib/tcl8.6
/lib/tcl8.6

That is, L looks for libl.tcl in only two places: where it would be located inside it's build tree and the system copy.

Talking in the IRC channel, georgn suggested the following:

10:19:07      @georgn | in our top level Makefile, we define INSTALL_ROOT -- I'm guessing that's the culprit
@MMI
Copy link
Member

MMI commented Apr 21, 2016

Here are proposed diffs:

#### ChangeSet ####
2016-04-21 13:14:56-04:00, [email protected]
  Fix build so prefix works properly.

==== Makefile ====
2016-04-21 13:14:56-04:00, [email protected] +15 -12
  Fix build so prefix works properly.
--- 1.9/Makefile    2016-04-14 18:09:00 -04:00
+++ 1.10/Makefile   2016-04-21 13:14:56 -04:00
@@ -1,5 +1,6 @@
 # "make install" locations
-PREFIX = /usr/local
+PREFIX = /opt/little-lang
+BINDIR := $(PREFIX)/bin
 LGUI_OSX_INSTALL_DIR = /Applications  # for the OS X application bundle

 MAJOR=1
@@ -24,30 +25,30 @@ ifeq "$(PLATFORM)" "win"
    EXE=.exe
    TCLSH_NAME=tclsh.exe
    WISH_NAME=wish86.exe
-   WISH=$(L_BUILD_ROOT)/bin/$(WISH_NAME)
+   WISH=$(L_BUILD_ROOT)/$(BINDIR)/$(WISH_NAME)
    TCLSH_CONFIGURE_OPTS=--enable-shared
    TK_CONFIGURE_OPTS=--enable-shared
 endif
 ifeq "$(PLATFORM)" "macosx"
    S := unix
    TCLSH_NAME=tclsh
    WISH_NAME=wish8.6
-   WISH=$(LGUI_BUILD_ROOT)/bin/$(WISH_NAME)
+   WISH=$(LGUI_BUILD_ROOT)/$(BINDIR)/$(WISH_NAME)
    TCLSH_CONFIGURE_OPTS=--enable-64bit --disable-shared
    TK_CONFIGURE_OPTS=--enable-64bit --enable-framework --enable-aqua
 endif
 ifeq "$(PLATFORM)" "unix"
    S := unix
    TCLSH_NAME=tclsh
    WISH_NAME=wish8.6
-   WISH=$(L_BUILD_ROOT)/bin/$(WISH_NAME)
+   WISH=$(L_BUILD_ROOT)/$(BINDIR)/$(WISH_NAME)
    TCLSH_CONFIGURE_OPTS=--enable-64bit --disable-shared
    TK_CONFIGURE_OPTS=--enable-64bit --disable-xss --enable-xft --disable-shared
 endif
-TCLSH=$(L_BUILD_ROOT)/bin/$(TCLSH_NAME)
-L=$(L_BUILD_ROOT)/bin/L$(EXE)
+TCLSH=$(L_BUILD_ROOT)/$(BINDIR)/$(TCLSH_NAME)
+L=$(L_BUILD_ROOT)/$(BINDIR)/L$(EXE)
 l=$(L_BUILD_ROOT)/bin/l$(EXE)
-L-gui=$(L_BUILD_ROOT)/bin/L-gui$(EXE)
+L-gui=$(L_BUILD_ROOT)/$(BINDIR)/L-gui$(EXE)
 l-gui=$(L_BUILD_ROOT)/bin/l-gui$(EXE)

 all: ## default, build for `./platform`
@@ -71,7 +72,8 @@ $(TCLSH):
    $(MAKE) tcl/$(S)/Makefile
    echo "proc Lver {} { return \"$(MAJOR).$(MINOR)\" }" >tcl/library/Lver.tcl
    cd tcl/$(S) && \
-       $(MAKE) prefix= exec_prefix= INSTALL_ROOT=../../$(L_BUILD_ROOT) \
+       $(MAKE) prefix=$(PREFIX) exec_prefix=$(PREFIX) libdir=$(PREFIX)/lib \
+       INSTALL_ROOT=../../$(L_BUILD_ROOT) \
        install-binaries install-libraries
    mv $(TCLSH) $(L)

@@ -83,7 +85,8 @@ $(WISH):
    $(MAKE) $(TCLSH)
    $(MAKE) tk/$(S)/Makefile
    cd tk/$(S) && \
-       $(MAKE) XLIBS=`pwd`/../../$(LIBPCRE) prefix= exec_prefix= \
+       $(MAKE) XLIBS=`pwd`/../../$(LIBPCRE) \
+       prefix=$(PREFIX) exec_prefix=$(PREFIX) libdir=$(PREFIX)/lib \
        INSTALL_ROOT=../../$(L_BUILD_ROOT) \
        install-binaries install-libraries; \
    pwd
@@ -142,18 +145,18 @@ clobber: ## really clean up, assumes BK,
    @$(MAKE) clean
    rm -rf L

-doc: $(L_BUILD_ROOT)/bin/tclsh ## build little.html, some docs
+doc: $(L_BUILD_ROOT)/$(BINDIR)/tclsh ## build little.html, some docs
    $(MAKE) -C tcl/doc/L little.html
    -test -d L/doc/L || mkdir -p L/doc/L
    cp tcl/doc/L/little.html L/doc/L
    $(MAKE) -C tcl/doc/l-paper little.pdf
    cp tcl/doc/l-paper/little.pdf L/doc/L

-install: all ## install to $(PREFIX) (default /usr/local)
+install: all ## install to $(PREFIX) (default /opt/little-lang)
    @$(MAKE) doc
    @test -d $(PREFIX) || mkdir $(PREFIX)
    @test -w $(PREFIX) || { echo cannot write $(PREFIX); exit 1; }
-   cp -pr $(L_BUILD_ROOT)/* $(PREFIX)
+   cp -pr $(L_BUILD_ROOT)/$(PREFIX)/* $(L_BUILD_ROOT)/doc $(PREFIX)
    -test "$(PLATFORM)" = "macosx" && cp -pr $(LGUI_BUILD_ROOT)/tk/Lgui.app $(LGUI_OSX_INSTALL_DIR)

 help:

#### tcl/ChangeSet ####
2016-04-21 13:14:56-04:00, [email protected] +1 -0
  Fix build so prefix works properly.

==== tcl/doc/l-paper/Makefile ====
2016-04-21 13:14:55-04:00, [email protected] +8 -1
  Make the building of the pdf portable to mac.
--- 1.8/tcl/doc/l-paper/Makefile    2016-04-14 11:12:32 -04:00
+++ 1.9/tcl/doc/l-paper/Makefile    2016-04-21 13:14:55 -04:00
@@ -1,5 +1,12 @@
+ifeq "$(shell uname -s)" "Darwin"
+   PS2PDF  := pstopdf
+   OUT = -o $@
+else
+   PS2PDF  := ps2pdf
+endif
+
 little.pdf: little.ps little.ms
-   ps2pdf $<
+   $(PS2PDF) $(OUT) $<

 little.ps: little.ms references
    groff -e -R -ms -p -t $< > $@

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants