Blog 2020/5/2
<- previous | index | next ->
Here's a script I use to install Janet from source on Linux machines:
#!/bin/bash
set -e -o pipefail
version=1.10.1
prefix=/opt/janet-$version
tarball=janet-${version}.tar.gz
url=https://github.com/janet-lang/janet/archive/v${version}.tar.gz
mkdir -p $HOME/dist
cd $HOME/dist
test -e $tarball || wget -O $tarball $url
cd /tmp
rm -rf janet-$version
cat $HOME/dist/$tarball | gunzip | tar x
cd janet-$version
make PREFIX=$prefix
make test PREFIX=$prefix
make install PREFIX=$prefix
ln -sf ${prefix}/bin/janet /usr/local/bin/
ln -sf ${prefix}/bin/jpm /usr/local/bin/
Note: I was able to get Janet 1.8.1 to build on Windows 7 / MSYS2 by making two modifications to the Makefile
:
- remove
-rdynamic
from theLDFLAGS
- swap the order of the two
ln -sf
lines in theinstall:
target
Here is the diff:
--- Makefile 2020-05-02 21:08:04.416775300 -0500
+++ Makefile.mod 2020-05-02 20:04:05.113179600 -0500
@@ -38,7 +38,7 @@
DEBUGGER=gdb
CFLAGS:=$(CFLAGS) -std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fPIC -O2 -fvisibility=hidden
-LDFLAGS:=$(LDFLAGS) -rdynamic
+LDFLAGS:=$(LDFLAGS)
# For installation
LDCONFIG:=ldconfig "$(LIBDIR)"
@@ -254,8 +254,8 @@
mkdir -p '$(DESTDIR)$(LIBDIR)'
cp $(JANET_LIBRARY) '$(DESTDIR)$(LIBDIR)/libjanet.so.$(shell $(JANET_TARGET) -e '(print janet/version)')'
cp $(JANET_STATIC_LIBRARY) '$(DESTDIR)$(LIBDIR)/libjanet.a'
- ln -sf $(SONAME) '$(DESTDIR)$(LIBDIR)/libjanet.so'
ln -sf libjanet.so.$(shell $(JANET_TARGET) -e '(print janet/version)') $(DESTDIR)$(LIBDIR)/$(SONAME)
+ ln -sf $(SONAME) '$(DESTDIR)$(LIBDIR)/libjanet.so'
cp -rf auxbin/* '$(DESTDIR)$(BINDIR)'
mkdir -p '$(DESTDIR)$(MANPATH)'
cp janet.1 '$(DESTDIR)$(MANPATH)'
You can tell vim to use Clojure's syntax highlighting for Janet files:
syntax on
filetype on
au BufNewFile,BufRead *.janet set filetype=clojure
Modifying the script to install in
$HOME/opt/
is simple: