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

janet-netrepl and janet-format missing from bundle/init.janet? #187

Closed
sogaiu opened this issue Jun 25, 2024 · 7 comments
Closed

janet-netrepl and janet-format missing from bundle/init.janet? #187

sogaiu opened this issue Jun 25, 2024 · 7 comments

Comments

@sogaiu
Copy link
Contributor

sogaiu commented Jun 25, 2024

After installing via (bundle/install "."), I don't get janet-netrepl or janet-format on my PATH.

May be they need to get mentioned in bundle/init.janet?

I wasn't sure how to indicate where they should get installed. In some testing, I used a destination via relative paths, but wasn't confident that is advisable.

Something like:

(bundle/add-file manifest "bin/janet-netrepl" "../../bin/janet-netrepl" 8r755)
@pepe
Copy link
Member

pepe commented Jun 26, 2024

Thank you for exploring bundle corners!

@sogaiu
Copy link
Contributor Author

sogaiu commented Jul 12, 2024

Possibly relevant bit from jpm man page:

JANET_BINPATH
       The directory where jpm will install binary scripts and
       executables to.  Defaults to (dyn :syspath)/bin The
       --binpath=/some/path will override this variable.

@sogaiu
Copy link
Contributor Author

sogaiu commented Jul 13, 2024

Perhaps this commit may contain something that will help with this issue.

@sogaiu
Copy link
Contributor Author

sogaiu commented Jul 13, 2024

Using a janet with the commit mentioned in the previous comment, the following diff seems to get things to work:

diff --git a/bundle/init.janet b/bundle/init.janet
index b0c2dd7..5a5d7eb 100644
--- a/bundle/init.janet
+++ b/bundle/init.janet
@@ -3,6 +3,10 @@
 
 (defn install [m &]
   (bundle/add-file m "src/tarray.h" "tarray.h")
+  (each file (os/dir "bin")
+    (def f (string "bin/" file))
+    (when (= (os/stat f :mode) :file)
+      (bundle/add-bin m f)))
   (bundle/add m "spork")
   (each file (os/dir "build")
     (def f (string "build/" file))

...but perhaps it feels a bit repetitive?

Here's another attempt:

diff --git a/bundle/init.janet b/bundle/init.janet
index b0c2dd7..5cb40b3 100644
--- a/bundle/init.janet
+++ b/bundle/init.janet
@@ -4,10 +4,15 @@
 (defn install [m &]
   (bundle/add-file m "src/tarray.h" "tarray.h")
   (bundle/add m "spork")
-  (each file (os/dir "build")
-    (def f (string "build/" file))
-    (when (= (os/stat f :mode) :file)
-      (bundle/add-file m f (string "spork/" file)))))
+  (each dir ["bin" "build"]
+    (each file (os/dir dir)
+      (def f (string dir "/" file))
+      (when (= (os/stat f :mode) :file)
+        (cond
+          (= "bin" dir)
+          (bundle/add-bin m f)
+          (= "build" dir)
+          (bundle/add-file m f (string "spork/" file)))))))
 
 (defn clean [&]
   (sh/rm "build"))

Not sure if that's a net win...

@sogaiu
Copy link
Contributor Author

sogaiu commented Jul 14, 2024

As another piece of info regarding destinations, there is this line in jpm's source:

:binpath (string prefix "/bin")

I guess this tends to end up at a different location compared to (dyn *syspath*)/bin as prefix is typically something like /usr/local or $HOME/.local.

Probably obvious, but IIUC the above is for *nixy systems and doesn't apply as-is for Windows.

@bakpakin
Copy link
Member

bakpakin commented Aug 9, 2024

So taking a look at this, spork should be updated now.

As for binpath, we are taking a different approach with installing scripts with bundle. All scripts will now just be installed to (string (dyn *syspath*) "/bin"), and the user would be expected to modify their path. If you wanted to actually put scripts in /usr/bin or similar, one could use a symlink. This avoids extra configuration as well as makes it clear these scripts are installed by bundle/install.

@bakpakin bakpakin closed this as completed Aug 9, 2024
@sogaiu
Copy link
Contributor Author

sogaiu commented Aug 10, 2024

Thanks for the clarification.

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

3 participants