2010-03-08 12:22:58 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Luajit < Formula
|
2010-09-10 05:37:52 +00:00
|
|
|
homepage 'http://luajit.org/luajit.html'
|
2012-03-28 15:24:55 +00:00
|
|
|
url 'http://luajit.org/download/LuaJIT-2.0.0-beta9.tar.gz'
|
2011-12-17 22:12:44 +00:00
|
|
|
md5 'e7e03e67e2550817358bc28b44270c6d'
|
2012-04-19 02:37:43 +00:00
|
|
|
|
|
|
|
head 'http://luajit.org/git/luajit-2.0.git'
|
2010-03-08 12:22:58 +00:00
|
|
|
|
2011-04-01 12:57:51 +00:00
|
|
|
# Skip cleaning both empty folders and bin/libs so external symbols still work.
|
|
|
|
skip_clean :all
|
2010-03-08 12:22:58 +00:00
|
|
|
|
2011-06-09 19:23:07 +00:00
|
|
|
def options
|
2012-03-15 22:20:25 +00:00
|
|
|
[["--enable-debug", "Build with debugging symbols."]]
|
2011-06-09 19:23:07 +00:00
|
|
|
end
|
|
|
|
|
2012-03-28 15:23:41 +00:00
|
|
|
def patches
|
2012-03-31 23:31:51 +00:00
|
|
|
unless ARGV.build_head? then
|
|
|
|
# Remove all patches at 2.0.0-beta10. They are fixed in HEAD.
|
|
|
|
# Patch 1: Hotfix is recommended by the LuaJIT developers.
|
|
|
|
# Patch 2: Fixes no /usr/include/unwind.h on Snow Leopard for Clang.
|
|
|
|
# DATA fixes build error with clang, no -dumpspecs options. Also removes
|
|
|
|
# the instruction to use sudo to symlink luajit. We do that already.
|
|
|
|
[ "http://luajit.org/download/beta9_hotfix1.patch",
|
|
|
|
"http://repo.or.cz/w/luajit-2.0.git/patch/018792452ecdcaeff9362e4238004420665b450b",
|
|
|
|
DATA ]
|
|
|
|
end
|
2012-03-28 15:23:41 +00:00
|
|
|
end
|
|
|
|
|
2010-03-08 12:22:58 +00:00
|
|
|
def install
|
2012-03-31 23:31:51 +00:00
|
|
|
# 1 - Remove the '-O2' so we can set Og if needed. Leave the -fomit part.
|
|
|
|
# 2 - Override the hardcoded gcc.
|
|
|
|
# 3 - Remove the '-march=i686' so we can set the march in cflags.
|
|
|
|
# All three changes should persist and were discussed upstream.
|
|
|
|
inreplace 'src/Makefile' do |f|
|
|
|
|
f.change_make_var! 'CCOPT', '-fomit-frame-pointer'
|
|
|
|
f.change_make_var! 'CC', ENV.cc
|
|
|
|
f.change_make_var! 'CCOPT_X86', ''
|
2011-06-09 19:23:07 +00:00
|
|
|
end
|
2011-08-24 04:31:05 +00:00
|
|
|
|
2012-03-31 23:31:51 +00:00
|
|
|
ENV.O2 # Respect the developer's choice.
|
|
|
|
args = [ "PREFIX=#{prefix}" ]
|
|
|
|
if ARGV.include? '--enable-debug' then
|
|
|
|
ENV.Og if ENV.compiler == :clang
|
|
|
|
args << 'CCDEBUG=-g'
|
|
|
|
end
|
|
|
|
|
|
|
|
bldargs = args
|
|
|
|
bldargs << 'amalg'
|
|
|
|
system 'make', *bldargs
|
|
|
|
args << 'install'
|
|
|
|
system 'make', *args # Build requires args during install
|
|
|
|
|
2011-04-01 12:57:51 +00:00
|
|
|
# Non-versioned symlink
|
2011-08-24 04:31:05 +00:00
|
|
|
if ARGV.build_head?
|
2011-12-17 22:12:44 +00:00
|
|
|
version = "2.0.0-beta9"
|
2011-08-24 04:31:05 +00:00
|
|
|
else
|
|
|
|
version = @version
|
|
|
|
end
|
2011-04-01 12:57:51 +00:00
|
|
|
ln_s bin+"luajit-#{version}", bin+"luajit"
|
2010-03-08 12:22:58 +00:00
|
|
|
end
|
|
|
|
end
|
2012-03-31 23:31:51 +00:00
|
|
|
|
|
|
|
__END__
|
|
|
|
--- a/src/Makefile
|
|
|
|
+++ b/src/Makefile
|
|
|
|
@@ -219,10 +219,6 @@
|
|
|
|
TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_FLAGS) $(TARGET_SHLDFLAGS)
|
|
|
|
TARGET_ALIBS= $(TARGET_XLIBS) $(LIBS) $(TARGET_LIBS)
|
|
|
|
|
|
|
|
-ifneq (,$(findstring stack-protector,$(shell $(TARGET_CC) -dumpspecs)))
|
|
|
|
- TARGET_XCFLAGS+= -fno-stack-protector
|
|
|
|
-endif
|
|
|
|
-
|
|
|
|
TARGET_TESTARCH=$(shell $(TARGET_CC) $(TARGET_ACFLAGS) -E lj_arch.h -dM)
|
|
|
|
ifneq (,$(findstring LJ_TARGET_X64 ,$(TARGET_TESTARCH)))
|
|
|
|
TARGET_CCARCH= x64
|
|
|
|
@@ -283,9 +279,12 @@
|
|
|
|
TARGET_DYNXLDOPTS=
|
|
|
|
else
|
|
|
|
ifeq (Darwin,$(TARGET_SYS))
|
|
|
|
- export MACOSX_DEPLOYMENT_TARGET=10.4
|
|
|
|
+ ifeq (,$(MACOSX_DEPLOYMENT_TARGET))
|
|
|
|
+ export MACOSX_DEPLOYMENT_TARGET=10.4
|
|
|
|
+ endif
|
|
|
|
TARGET_STRIP+= -x
|
|
|
|
TARGET_AR+= 2>/dev/null
|
|
|
|
+ TARGET_XCFLAGS+= -fno-stack-protector
|
|
|
|
TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
|
|
|
|
TARGET_DYNXLDOPTS=
|
|
|
|
TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
|
|
|
|
@@ -297,10 +296,14 @@
|
|
|
|
ifeq (iOS,$(TARGET_SYS))
|
|
|
|
TARGET_STRIP+= -x
|
|
|
|
TARGET_AR+= 2>/dev/null
|
|
|
|
+ TARGET_XCFLAGS+= -fno-stack-protector
|
|
|
|
TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
|
|
|
|
TARGET_DYNXLDOPTS=
|
|
|
|
TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
|
|
|
|
else
|
|
|
|
+ ifneq (,$(findstring stack-protector,$(shell $(TARGET_CC) -dumpspecs)))
|
|
|
|
+ TARGET_XCFLAGS+= -fno-stack-protector
|
|
|
|
+ endif
|
|
|
|
ifneq (SunOS,$(TARGET_SYS))
|
|
|
|
TARGET_XLDFLAGS+= -Wl,-E
|
|
|
|
endif
|
|
|
|
--- a/Makefile 2012-03-31 11:23:39.000000000 -0700
|
|
|
|
+++ b/Makefile 2012-03-31 11:24:20.000000000 -0700
|
|
|
|
@@ -116,11 +116,6 @@
|
|
|
|
cd lib && $(INSTALL_F) $(FILES_JITLIB) $(INSTALL_JITLIB)
|
|
|
|
@echo "==== Successfully installed LuaJIT $(VERSION) to $(PREFIX) ===="
|
|
|
|
@echo ""
|
|
|
|
- @echo "Note: the beta 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)"
|
|
|
|
- @echo ""
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
|