On Thu, Apr 30, 2020 at 08:37:09AM -0400, Andrea Fleckenstein wrote:
> running the following with the binary packaged leiningen
> reveals something that doesn't look quite right:
> 
> $ DEBUG=1 lein
> 
> Leiningen's classpath: 
> :/usr/obj/ports/leiningen-2.9.1/fake-amd64/usr/local/share/leiningen/leiningen-2.9.1-standalone.zip
That path comes from the porter that packaged and committed leiningen
(me).

> Error: Could not find or load main class clojure.main
> 
> with the ports version, we get:
> 
> $ DEBUG=1 lein
> 
> Leiningen's classpath: 
> :/usr/ports/pobj/leiningen-2.9.1/fake-amd64/usr/local/share/leiningen/leiningen-2.9.1-standalone.zip
This is from your local machine, it's different but works because that
path is obviously valid - except mostly for you just like mine above
worked during packaging.

> Applying task help to []
> Leiningen is a tool for working with Clojure projects.
> <snip>
> 
> the culprit seems to be related to patches/patch-bin_lein-pkg, excerpted
> here:
> 
> @@ -43,7 +43,7 @@ LEIN_JVM_OPTS="${LEIN_JVM_OPTS:-'-Xms64m -Xmx512m'}"
>  # If you're not using an uberjar you'll need to list each dependency
>  # and add them individually to the classpath/bootclasspath as well.
>  
> -LEIN_JAR=/usr/share/java/leiningen-$LEIN_VERSION-standalone.jar
> +LEIN_JAR=${LEIN_DIR}/${JAR_FILE}
>  
> LEIN_DIR is defined in the makefile as ${PREFIX}/share/leiningen
> 
> can anyone point me in the right direction for fixing this? I don't
> exactly understand how the $PREFIX variable works in ports. the man page
> says it's set to $LOCALBASE, but isn't that just "/usr/local/"?
PREFIX contains DESTDIR, see bsd.port.mk(5) for TRUEPREFIX.  The latter
is what ought to be the path once packaged/installed on your system,
the former is build environment specific (DESTDIR) and must therefore
not end up in packages.

Perhaps there is a more clever way to fix this, but diff below fixes
your problem py patching TRUEPREFIX instead of PREFIX:  this way
/usr/local/bin/lein ends up with

LEIN_JAR=/usr/local/share/leiningen/leiningen-2.9.1-standalone.zip

and works as expected on *every system*.

Thanks for noticing as well as pointing out the issue at once.

Feedback? OK?


Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/leiningen/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- Makefile    29 Nov 2019 01:29:15 -0000      1.7
+++ Makefile    30 Apr 2020 12:52:34 -0000
@@ -5,6 +5,7 @@ COMMENT =               Clojure project automation
 GH_ACCOUNT =           technomancy
 GH_PROJECT =           leiningen
 GH_TAGNAME =           2.9.1
+REVISION =             0
 
 JAR_FILE =             ${DISTNAME}-standalone.zip
 
@@ -32,12 +33,13 @@ NO_TEST =           Yes
 LEIN =                 ${WRKSRC}/bin/lein-pkg
 DOC_DIR =              ${PREFIX}/share/doc/leiningen
 LEIN_DIR =             ${PREFIX}/share/leiningen
+TRUE_LEIN_DIR =                ${TRUEPREFIX}/share/leiningen
 BASH_DIR =             ${PREFIX}/share/bash_completion.d
 ZSH_DIR =              ${PREFIX}/share/zsh/site-functions
 
 SUBST_VARS +=          JAR_FILE \
                        JAVA_HOME \
-                       LEIN_DIR
+                       TRUE_LEIN_DIR
 
 do-install:
        ${SUBST_PROGRAM} ${LEIN} ${PREFIX}/bin/lein
Index: patches/patch-bin_lein-pkg
===================================================================
RCS file: /cvs/ports/devel/leiningen/patches/patch-bin_lein-pkg,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-bin_lein-pkg
--- patches/patch-bin_lein-pkg  29 Nov 2019 01:07:49 -0000      1.1.1.1
+++ patches/patch-bin_lein-pkg  30 Apr 2020 12:52:30 -0000
@@ -28,7 +28,7 @@ Index: bin/lein-pkg
  # and add them individually to the classpath/bootclasspath as well.
  
 -LEIN_JAR=/usr/share/java/leiningen-$LEIN_VERSION-standalone.jar
-+LEIN_JAR=${LEIN_DIR}/${JAR_FILE}
++LEIN_JAR=${TRUE_LEIN_DIR}/${JAR_FILE}
  
  # Do not use installed leiningen jar during self-compilation
  if ! { [ "$1" = "compile" ] &&

Reply via email to