Skip to content

Commit

Permalink
Merge branch 'master' into testsuite-plusslow
Browse files Browse the repository at this point in the history
  • Loading branch information
lukego committed Mar 15, 2017
2 parents 9fedd59 + 03875be commit 1c74123
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 34 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: c
language: nix
sudo: false
script:
- make
- src/luajit -e 'for i = 1, 1000 do end'
- nix-build
- result/bin/raptorjit -e 'for i = 1, 1000 do end'
- git submodule init submodules/raptorjit-testsuite
- (cd submodules/raptorjit-testsuite/test; ../../../src/luajit test.lua +slow)
- (cd submodules/raptorjit-testsuite/test; ../../../result/bin/raptorjit test.lua +slow)
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,35 @@ Initial changes (ongoing work):

PRs welcome! Shock me with your radical ideas! :-)

### Compilation

RaptorJIT is built using GNU Make, Clang (C compiler), and LuaJIT 2 (bootstrap Lua for DynASM etc.) The build environment is specified formally in `default.nix` and can be automatically provided using the [nix](http://nixos.org/nix/) package manager.

Here is how to install nix:

```
$ curl https://nixos.org/nix/install | sh
```

Here is how to build raptorjit once nix is installed (note: the first
compilation takes time to download dependencies):

```shell
$ nix-build # produces result/bin/raptorjit
```

Here is the interactive version:

```
$ nix-shell # start sub-shell with pristine build environment in $PATH
[nix-shell]$ make -j # build manually as many times as you like
[nix-shell]$ exit # quit when done
```

(You can also skip `nix` and install `clang` and `luajit` yourself if
you like. The nix approach is future proof to new dependencies and
allows for pinning specific versions.)

### Quotes

Here are some borrowed words to put this branch into context:
Expand Down
19 changes: 19 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{ pkgs ? (import <nixpkgs> {})
, source ? ./.
, version ? "dev"
}:

with pkgs;
with clangStdenv;

mkDerivation rec {
name = "raptorjit-${version}";
inherit version;
src = lib.cleanSource source;
enableParallelBuilding = true;
buildInputs = [ luajit ];
installPhase = ''
mkdir -p $out/bin
cp src/luajit $out/bin/raptorjit
'';
}
34 changes: 4 additions & 30 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ NODOTABIVER= 51
# removing the '#' in front of them. Make sure you force a full recompile
# with "make clean", followed by "make" if you change any options.
#
DEFAULT_CC = gcc
DEFAULT_CC = clang
#
# LuaJIT builds as a native 32 or 64 bit binary by default.
CC= $(DEFAULT_CC)
Expand Down Expand Up @@ -192,9 +192,7 @@ LDOPTIONS= $(CCDEBUG) $(LDFLAGS)

HOST_CC= $(CC)
HOST_RM= rm -f
# If left blank, minilua is built and used. You can supply an installed
# copy of (plain) Lua 5.1 or 5.2, plus Lua BitOp. E.g. with: HOST_LUA=lua
HOST_LUA=
HOST_LUA=luajit

HOST_XCFLAGS= -I.
HOST_XLDFLAGS=
Expand Down Expand Up @@ -373,16 +371,6 @@ endif
# Files and pathnames.
##############################################################################

MINILUA_O= host/minilua.o
MINILUA_LIBS= -lm
MINILUA_T= host/minilua
MINILUA_X= $(MINILUA_T)

ifeq (,$(HOST_LUA))
HOST_LUA= $(MINILUA_X)
DASM_DEP= $(MINILUA_T)
endif

DASM_DIR= ../dynasm
DASM= $(HOST_LUA) $(DASM_DIR)/dynasm.lua
DASM_XFLAGS=
Expand Down Expand Up @@ -464,8 +452,8 @@ BUILDVM_O= host/buildvm.o host/buildvm_asm.o host/buildvm_peobj.o \
BUILDVM_T= host/buildvm
BUILDVM_X= $(BUILDVM_T)

HOST_O= $(MINILUA_O) $(BUILDVM_O)
HOST_T= $(MINILUA_T) $(BUILDVM_T)
HOST_O= $(BUILDVM_O)
HOST_T= $(BUILDVM_T)

LJVM_S= lj_vm.S
LJVM_O= lj_vm.o
Expand Down Expand Up @@ -547,16 +535,6 @@ ifeq (PS3,$(TARGET_SYS))
BUILDMODE= static
endif

ifeq (Windows,$(HOST_SYS))
MINILUA_T= host/minilua.exe
BUILDVM_T= host/buildvm.exe
ifeq (,$(HOST_MSYS))
MINILUA_X= host\minilua
BUILDVM_X= host\buildvm
ALL_RM:= $(subst /,\,$(ALL_RM))
endif
endif

ifeq (static,$(BUILDMODE))
TARGET_DYNCC= @:
TARGET_T= $(LUAJIT_T)
Expand Down Expand Up @@ -624,10 +602,6 @@ depend:
# Rules for generated files.
##############################################################################

$(MINILUA_T): $(MINILUA_O)
$(E) "HOSTLINK $@"
$(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(MINILUA_O) $(MINILUA_LIBS) $(HOST_ALIBS)

host/buildvm_arch.h: $(DASM_DASC) $(DASM_DEP) $(DASM_DIR)/*.lua
$(E) "DYNASM $@"
$(Q)$(DASM) $(DASM_FLAGS) -o $@ $(DASM_DASC)
Expand Down

0 comments on commit 1c74123

Please sign in to comment.