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

Should add more distribution methods (various GNU/Linux distro package managers, an official Docker repository etc.) #324

Open
ahungry opened this issue Mar 25, 2020 · 12 comments

Comments

@ahungry
Copy link
Contributor

ahungry commented Mar 25, 2020

Janet runs quite nicely in a base alpine docker image as such:

       FROM alpine:latest

       RUN apk add --update git gcc make libc-dev
       WORKDIR /usr/src
       RUN git clone https://github.com/janet-lang/janet /usr/src/janet && cd /usr/src/janet && make && make install
       CMD /usr/local/bin/janet

If you were to make an official repo on docker hub, you could allow people to run this very small image of a janet repl/runtime with no more needed than:

docker run --rm -it janet:latest

While also serving as a strong base for a build image.

Similarly, having "pacman -S janet" or "apt-get install janet" just work out of the box would really help with proliferating the language.

thoughts?

@bakpakin
Copy link
Member

I think putting an official image on docker hub would be nice, as the official image could be quite small and easy to maintain.

I personally don’t feel like maintaining or even advocating for distro packages, but other people are free to do so. If Janet does land in Debian or Ubuntu, I would work to ensure backwards compatibility somewhat as those are less rolling releases than things like arch, homebrew, and gentoo.

It’s also worth noting that to have a good experience with Janet and jpm, having a C compiler toolchain installed is useful, as well as git. And once you have a toolchain and git, installing Janet from source is pretty simple.

So I think for the docker image, it would be good to have a janet-micro image, which is like alpine Linux and with no git nor gcc, and a janet-development image which has gcc and git installed so jpm will work.

@cellularmitosis
Copy link
Contributor

cellularmitosis commented May 3, 2020

On a related note, here is a script to build and install janet into /opt.

#!/bin/bash

set -e -o pipefail

version=1.8.1
url=https://github.com/janet-lang/janet/archive/v${version}.tar.gz
mkdir -p $HOME/dist
if [ ! -e $HOME/janet-${version}.tar.gz ]; then
     wget -O $HOME/dist/janet-${version}.tar.gz $url
fi

cd /tmp
rm -rf janet-${version}
cat $HOME/dist/janet-${version}.tar.gz | gunzip | tar x
cd janet-${version}
make PREFIX=/opt/janet-${version}
make test PREFIX=/opt/janet-${version}
make install PREFIX=/opt/janet-${version}
ln -sf /opt/janet-${version}/bin/janet /usr/local/bin/
ln -sf /opt/janet-${version}/bin/jpm /usr/local/bin/

Edit: the above was tested on Debian (Buster) (i686, x86_64, ARMv5), Raspbian (Buster) (ARMv7), and macOS (Mojave) / Homebrew.

@cellularmitosis
Copy link
Contributor

cellularmitosis commented May 3, 2020

By the way, the above script works on Windows 7 / MSYS2 if you make the following modifications to the Makefile:

  • remove -rdynamic from the LDFLAGS line
  • swap the order of the two ln -sf lines in the install: target

One of the test cases fails under Windows 7 / MSYS2:

error: unable to create temporary file - Permission denied
  in file/temp
  in _thunk [test/suite7.janet] (tailcall) on line 300, column 10
make: *** [Makefile:191: test] Error 1

@cellularmitosis
Copy link
Contributor

I ran into issues on OS X (Tiger, PowerPC) due to missing clock_gettime, arc4random_buf and posix_spawn.

@cellularmitosis
Copy link
Contributor

cellularmitosis commented May 3, 2020

Startup time is fantastic!

time janet -e '(+ 1 1)'

  • i7 3280 2.7GHz: 7ms
  • i3 2350 2.3GHz: 8ms
  • Core 2 1.86GHz: 5ms (lol, faster???)
  • Atom 1.6GHz: 18ms
  • Geode LX 433MHz: 39ms
  • Geode GX 366MHz: 78ms
  • ARMv7 1.2GHz: 22ms
  • ARMv5 800Mhz: 37ms
  • ARMv5 266MHz: 100ms

@allisio
Copy link

allisio commented May 3, 2020

Startup time is fantastic!

Not just the startup time! Janet is, like, crazy-fast.

$ thyme 100 janet bf.janet hw.bf
     26 0.003
     64 0.004
      8 0.005
      2 0.006

That's executing this brainfuck interpreter on this input, and doing so practically immediately on an i5-5300U. Serious candidate for new sweet-spot Lisp.

@cellularmitosis
Copy link
Contributor

Ooh, what is thyme? Having trouble googling it.

@allisio
Copy link

allisio commented May 3, 2020

Ah, that's just a little zsh function I have for running the time builtin repeatedly and collecting the results into a histogram:

thyme() {
    n=$1; shift
    repeat $n do
        (time $* > /dev/null) 2>&1 | cut -d ' ' -f 9
    done | sort -n | uniq -c
}

It's not exactly surgical, but it works fine for off-the-cuff benchmarks.

@cellularmitosis
Copy link
Contributor

(sorry for the thread hijack!)

A while back I used a trivial (non-tail-recursive) fibonacci benchmark to compare startup latency and raw function-call throughput of some scheme interpreters: https://gist.github.com/cellularmitosis/aa3001c8d5a961f7b382f6576978b644

Today I updated this by adding Clojure, Planck, Joker, and Janet.

Screen Shot 2020-05-03 at 9 49 03 AM

Screen Shot 2020-05-03 at 9 49 14 AM

Again, Janet's startup latency is crazy! Additionally, its throughput is also impressive, when you consider that Chez, Clojure, Planck, Racket are all JIT'ed.

I should add Guile 3.x, as that includes as JIT as well.

@froh
Copy link

froh commented May 16, 2020

You could use the open build server to build rpm and Deb packages and docker images.
https://openbuildservice.org/2018/05/09/container-building-and-distribution/

@amano-kenji
Copy link
Contributor

What are you talking about? Among all languages I tried, janet integrates the best with linux distribution package managers. Raku was the second best in terms of distro integration. Raku is pretty good, too.

I already integrated janet and jpm modules with gentoo linux and arch linux.

@ahungry
Copy link
Contributor Author

ahungry commented Aug 3, 2022

@amano-kenji who are you addressing?

My request here is that janet be in the official distributions, which is more of a maintenance request and not denying what you've stated (that janet is very portable).

pacman -Ss janet - still no results.

pikaur -Ss janet - produces janet-lang and some other candidates - so, that's a great improvement! Please note this thread is now 2 years old, and I don't think janet-lang was in the Arch linux AUR back then.

Maybe my original intent was more to press for the advocacy steps to promote janet interest in those distribution channels - obviously the debian/arch maintainers are unlikely to read/respond to this thread, so such a request for action would probably have to originate there and not here 😄

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

6 participants