Skip to content

Commit

Permalink
Merge pull request #193 from lukego/prepare-release-1.0
Browse files Browse the repository at this point in the history
Prepare for RaptorJIT 1.0 with installation fixes
  • Loading branch information
lukego authored Oct 14, 2018
2 parents d44450e + 56a88b2 commit 31d41be
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 56 deletions.
71 changes: 23 additions & 48 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
MAJVER= 1
MINVER= 0
RELVER= 0
PREREL= -alpha1
PREREL=
VERSION= $(MAJVER).$(MINVER).$(RELVER)$(PREREL)
ABIVER= 5.1

Expand All @@ -33,40 +33,31 @@ DPREFIX= $(DESTDIR)$(PREFIX)
INSTALL_BIN= $(DPREFIX)/bin
INSTALL_LIB= $(DPREFIX)/$(MULTILIB)
INSTALL_SHARE= $(DPREFIX)/share
INSTALL_INC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER)
INSTALL_INC= $(DPREFIX)/include/raptorjit-$(MAJVER).$(MINVER)

INSTALL_LJLIBD= $(INSTALL_SHARE)/luajit-$(VERSION)
INSTALL_LJLIBD= $(INSTALL_SHARE)/raptorjit-$(VERSION)
INSTALL_JITLIB= $(INSTALL_LJLIBD)/jit
INSTALL_LMODD= $(INSTALL_SHARE)/lua
INSTALL_LMOD= $(INSTALL_LMODD)/$(ABIVER)
INSTALL_CMODD= $(INSTALL_LIB)/lua
INSTALL_CMOD= $(INSTALL_CMODD)/$(ABIVER)
INSTALL_MAN= $(INSTALL_SHARE)/man/man1
INSTALL_PKGCONFIG= $(INSTALL_LIB)/pkgconfig

INSTALL_TNAME= luajit-$(VERSION)
INSTALL_TSYMNAME= luajit
INSTALL_ANAME= libluajit-$(ABIVER).a
INSTALL_SOSHORT1= libluajit-$(ABIVER).so
INSTALL_SOSHORT2= libluajit-$(ABIVER).so.$(MAJVER)

INSTALL_TNAME= raptorjit-$(VERSION)
INSTALL_TSYMNAME= raptorjit
INSTALL_ANAME= libraptorjit-$(ABIVER).a
INSTALL_SOSHORT1= libraptorjit-$(ABIVER).so
INSTALL_SOSHORT2= libraptorjit-$(ABIVER).so.$(MAJVER)
INSTALL_SONAME= $(INSTALL_SOSHORT2).$(MINVER).$(RELVER)
INSTALL_DYLIBSHORT1= libluajit-$(ABIVER).dylib
INSTALL_DYLIBSHORT2= libluajit-$(ABIVER).$(MAJVER).dylib
INSTALL_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).$(MINVER).$(RELVER).dylib
INSTALL_PCNAME= luajit.pc
INSTALL_DYLIBSHORT1= libraptorjit-$(ABIVER).dylib
INSTALL_DYLIBSHORT2= libraptorjit-$(ABIVER).$(MAJVER).dylib
INSTALL_DYLIBNAME= libraptorjit-$(ABIVER).$(MAJVER).$(MINVER).$(RELVER).dylib

INSTALL_STATIC= $(INSTALL_LIB)/$(INSTALL_ANAME)
INSTALL_DYN= $(INSTALL_LIB)/$(INSTALL_SONAME)
INSTALL_SHORT1= $(INSTALL_LIB)/$(INSTALL_SOSHORT1)
INSTALL_SHORT2= $(INSTALL_LIB)/$(INSTALL_SOSHORT2)
INSTALL_T= $(INSTALL_BIN)/$(INSTALL_TNAME)
INSTALL_TSYM= $(INSTALL_BIN)/$(INSTALL_TSYMNAME)
INSTALL_PC= $(INSTALL_PKGCONFIG)/$(INSTALL_PCNAME)

INSTALL_DIRS= $(INSTALL_BIN) $(INSTALL_LIB) $(INSTALL_INC) $(INSTALL_MAN) \
$(INSTALL_PKGCONFIG) $(INSTALL_JITLIB) $(INSTALL_LMOD) $(INSTALL_CMOD)
UNINSTALL_DIRS= $(INSTALL_JITLIB) $(INSTALL_LJLIBD) $(INSTALL_INC) \
$(INSTALL_LMOD) $(INSTALL_LMODD) $(INSTALL_CMOD) $(INSTALL_CMODD)
INSTALL_DIRS= $(INSTALL_BIN) $(INSTALL_LIB) $(INSTALL_INC) \
$(INSTALL_JITLIB)
UNINSTALL_DIRS= $(INSTALL_JITLIB) $(INSTALL_LJLIBD) $(INSTALL_INC)

RM= rm -f
MKDIR= mkdir -p
Expand All @@ -76,19 +67,12 @@ INSTALL_X= install -m 0755
INSTALL_F= install -m 0644
UNINSTALL= $(RM)
LDCONFIG= ldconfig -n
SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" \
-e "s|^multilib=.*|multilib=$(MULTILIB)|"

FILE_T= luajit
FILE_A= libluajit.a
FILE_SO= libluajit.so
FILE_MAN= luajit.1
FILE_PC= luajit.pc

FILE_T= raptorjit
FILE_A= libraptorjit.a
FILE_SO= libraptorjit.so
FILES_INC= lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h
FILES_JITLIB= bc.lua bcsave.lua dump.lua p.lua v.lua zone.lua \
dis_x86.lua dis_x64.lua dis_arm.lua dis_arm64.lua \
dis_ppc.lua dis_mips.lua dis_mipsel.lua dis_mips64.lua \
dis_mips64el.lua vmdef.lua
FILES_JITLIB= bc.lua bcsave.lua vmdef.lua

ifeq (,$(findstring Windows,$(OS)))
HOST_SYS:= $(shell uname -s)
Expand All @@ -106,7 +90,7 @@ endif

##############################################################################

INSTALL_DEP= src/luajit
INSTALL_DEP= src/raptorjit

default all $(INSTALL_DEP):
@echo "==== Building RaptorJIT $(VERSION) ===="
Expand All @@ -127,24 +111,15 @@ install: $(INSTALL_DEP)
$(LDCONFIG) $(INSTALL_LIB) && \
$(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT1) && \
$(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT2) || :
cd etc && $(INSTALL_F) $(FILE_MAN) $(INSTALL_MAN)
cd etc && $(SED_PC) $(FILE_PC) > $(FILE_PC).tmp && \
$(INSTALL_F) $(FILE_PC).tmp $(INSTALL_PC) && \
$(RM) $(FILE_PC).tmp
cd src && $(INSTALL_F) $(FILES_INC) $(INSTALL_INC)
cd src/jit && $(INSTALL_F) $(FILES_JITLIB) $(INSTALL_JITLIB)
@echo "==== Successfully installed RaptorJIT $(VERSION) to $(PREFIX) ===="
@echo ""
@echo "Note: the development releases deliberately do NOT install a symlink for luajit"
@echo "You can do this now by running this command (with sudo):"
@echo ""
@echo " $(SYMLINK) $(INSTALL_TNAME) $(INSTALL_TSYM)"
$(SYMLINK) $(INSTALL_TNAME) $(INSTALL_TSYM)
@echo ""


uninstall:
@echo "==== Uninstalling RaptorJIT $(VERSION) from $(PREFIX) ===="
$(UNINSTALL) $(INSTALL_T) $(INSTALL_STATIC) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2) $(INSTALL_MAN)/$(FILE_MAN) $(INSTALL_PC)
$(UNINSTALL) $(INSTALL_T) $(INSTALL_STATIC) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2)
for file in $(FILES_JITLIB); do \
$(UNINSTALL) $(INSTALL_JITLIB)/$$file; \
done
Expand Down
11 changes: 10 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,22 @@ let
old: { NIX_CFLAGS_COMPILE = "-Werror"; });
in

# Build RaptorJIT and run mulitple test suites.
# Build RaptorJIT and run multiple test suites.
{
raptorjit = raptorjit;
test-O3 = test "O3" "-O3";
test-O2 = test "O2" "-O2";
test-O1 = test "O1" "-O1";
test-nojit = test "nojit" "-joff";
# Test that generated bytecode is compatible
test-bytecode-compat = pkgs.runCommand "test-bytecode-compat"
{ buildInputs = [ raptorjit ]; }
''
echo "print('ok')" > test.lua
raptorjit -bg test.lua test.raw
raptorjit test.raw | grep ok
touch $out
'';
} //
(if check then { inherit nowarnings check-generated-code; } else {})

7 changes: 5 additions & 2 deletions raptorjit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ mkDerivation rec {
src = source;
buildInputs = [ luajit ]; # LuaJIT to bootstrap DynASM
dontStrip = true;
patchPhase = ''
substituteInPlace Makefile --replace "/usr/local" "$out"
'';
configurePhase = false;
installPhase = ''
install -D src/raptorjit $out/bin/raptorjit
install -D src/lj_dwarf.dwo $out/lib/raptorjit.dwo
make install PREFIX="$out"
'';

enableParallelBuilding = true; # Do 'make -j'
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ endif

TARGET_XCFLAGS+= -fno-stack-protector
TARGET_XLIBS+= -ldl
HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_LINUX
Host_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_LINUX

##############################################################################
# Files and pathnames.
Expand Down
2 changes: 1 addition & 1 deletion src/luaconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#endif
#define LUA_LROOT "/usr/local"
#define LUA_LUADIR "/lua/5.1/"
#define LUA_LJDIR "/luajit-2.1.0-beta2/"
#define LUA_LJDIR "/raptorjit-1.0.0/"

#ifdef LUA_ROOT
#define LUA_JROOT LUA_ROOT
Expand Down
6 changes: 3 additions & 3 deletions src/luajit.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@

#include "lua.h"

#define LUAJIT_VERSION "RaptorJIT 1.0.0-alpha1"
#define LUAJIT_VERSION_NUM 100000 /* Version 1.0.0 = 01.00.00. */
#define LUAJIT_VERSION_SYM luaJIT_version_2_1_0_beta2
#define LUAJIT_VERSION "RaptorJIT 1.0.0"
#define LUAJIT_VERSION_NUM 10000 /* Version 1.0.0 = 01.00.00. */
#define LUAJIT_VERSION_SYM luaJIT_version_1_0_0

#define LUAJIT_URL "http://github.com/raptorjit/raptorjit"

Expand Down

0 comments on commit 31d41be

Please sign in to comment.