Improve build support and prep a 1.0.1 bugfix
This commit is contained in:
parent
67460145fa
commit
8388e53235
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ kuroko
|
||||
*.dll
|
||||
wasm/
|
||||
jupyter/
|
||||
*.deb
|
||||
|
4
Makefile
4
Makefile
@ -85,3 +85,7 @@ test:
|
||||
stress-test:
|
||||
@for i in test/*.krk; do echo $$i; KUROKO_TEST_ENV=1 valgrind ./kuroko -g $$i > $$i.expect; done
|
||||
@git diff --exit-code test/*.expect
|
||||
|
||||
.PHONY: deb
|
||||
deb: kuroko libkuroko.so
|
||||
$(MAKE) -f Makefile.install
|
||||
|
39
Makefile.install
Normal file
39
Makefile.install
Normal file
@ -0,0 +1,39 @@
|
||||
REVISION ?= 0
|
||||
BASEDIR ?= /tmp/kuroko-pkg-build
|
||||
LIBCARCH ?= $(shell gcc -print-multiarch)
|
||||
DEBARCH ?= $(shell dpkg --print-architecture)
|
||||
VERSION ?= $(shell ./kuroko --version | sed 's/.* //')
|
||||
TARGET ?= kuroko_$(VERSION)-$(REVISION)_$(DEBARCH).deb
|
||||
|
||||
MAINTAINER ?= 'K. Lange <klange@toaruos.org>'
|
||||
GLIBCDEP ?= 'libc6 (>= 2.14)'
|
||||
DESC ?= "Bytecode-compiled interpreted dynamic programming language."
|
||||
URL ?= 'https://kuroko-lang.github.io/'
|
||||
|
||||
DESTDIR ?= /tmp/kuroko-pkg-build
|
||||
prefix ?= /usr
|
||||
includedir ?= $(prefix)/include
|
||||
bindir ?= $(prefix)/bin
|
||||
libdir ?= $(prefix)/lib
|
||||
|
||||
$(TARGET):
|
||||
# Install headers to target path.
|
||||
-rm -rf $(DESTDIR)
|
||||
mkdir -p $(DESTDIR)$(includedir)/kuroko
|
||||
cp src/*.h $(DESTDIR)$(includedir)/kuroko/
|
||||
# Install interpreter and strip
|
||||
mkdir -p $(DESTDIR)$(bindir)
|
||||
cp kuroko $(DESTDIR)$(bindir)/
|
||||
strip $(DESTDIR)$(bindir)/kuroko
|
||||
# Install libkuroko.so and strip
|
||||
mkdir -p $(DESTDIR)$(libdir)/$(LIBCARCH)
|
||||
cp libkuroko.so $(DESTDIR)$(libdir)/$(LIBCARCH)/libkuroko.so.$(VERSION)
|
||||
ln -s libkuroko.so.$(VERSION) $(DESTDIR)$(libdir)/$(LIBCARCH)/libkuroko.so
|
||||
strip $(DESTDIR)$(libdir)/$(LIBCARCH)/libkuroko.so.$(VERSION)
|
||||
# Install modules and strip
|
||||
mkdir -p $(DESTDIR)$(libdir)/kuroko
|
||||
cp -r modules/* $(DESTDIR)$(libdir)/kuroko/
|
||||
strip $(DESTDIR)$(libdir)/kuroko/*.so
|
||||
# Build package
|
||||
echo "Should build $(TARGET)"
|
||||
fpm -s dir -C $(DESTDIR) -t deb -n kuroko --license ISC --category devel -d $(GLIBCDEP) --version $(VERSION) --iteration $(REVISION) --directories $(libdir)/kuroko -m $(MAINTAINER) --description $(DESC) --url $(URL)
|
@ -74,10 +74,16 @@ const char krk_builtinsSrc[] =
|
||||
"\n"
|
||||
"# this works because `kuroko` is always a built-in\n"
|
||||
"import kuroko\n"
|
||||
"kuroko.module_paths = ['./','./modules/','/usr/local/lib/kuroko/']\n"
|
||||
"kuroko.module_paths = ['./']\n"
|
||||
"if 'executable_path' in dir(kuroko):\n"
|
||||
" let basepath = kuroko.path_sep.join(kuroko.executable_path.split(kuroko.path_sep)[:-1])\n"
|
||||
" kuroko.module_paths.append(basepath + kuroko.path_sep + 'modules' + kuroko.path_sep)\n"
|
||||
" let pathunits = kuroko.executable_path.split(kuroko.path_sep)[:-1]\n"
|
||||
" let dirname = pathunits[-1]\n"
|
||||
" if dirname == 'bin':\n"
|
||||
" pathunits.pop(-1)\n"
|
||||
" pathunits.extend(['lib','kuroko',''])\n"
|
||||
" else:\n"
|
||||
" pathunits.extend(['modules',''])\n"
|
||||
" kuroko.module_paths.append(kuroko.path_sep.join(pathunits))\n"
|
||||
"\n"
|
||||
"return object()\n"
|
||||
;
|
||||
|
@ -73,9 +73,15 @@ __builtins__.license = license
|
||||
|
||||
# this works because `kuroko` is always a built-in
|
||||
import kuroko
|
||||
kuroko.module_paths = ['./','./modules/','/usr/local/lib/kuroko/']
|
||||
kuroko.module_paths = ['./']
|
||||
if 'executable_path' in dir(kuroko):
|
||||
let basepath = kuroko.path_sep.join(kuroko.executable_path.split(kuroko.path_sep)[:-1])
|
||||
kuroko.module_paths.append(basepath + kuroko.path_sep + 'modules' + kuroko.path_sep)
|
||||
let pathunits = kuroko.executable_path.split(kuroko.path_sep)[:-1]
|
||||
let dirname = pathunits[-1]
|
||||
if dirname == 'bin':
|
||||
pathunits.pop(-1)
|
||||
pathunits.extend(['lib','kuroko',''])
|
||||
else:
|
||||
pathunits.extend(['modules',''])
|
||||
kuroko.module_paths.append(kuroko.path_sep.join(pathunits))
|
||||
|
||||
return object()
|
||||
|
Loading…
Reference in New Issue
Block a user