forked from lotia/homebrew-versions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
erlang-r14.rb
138 lines (116 loc) · 4.49 KB
/
erlang-r14.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
class ErlangR14 < Formula
homepage "http://www.erlang.org"
# Download tarball from GitHub; it is served faster than the official tarball.
url "https://github.com/erlang/otp/archive/OTP_R14B04.tar.gz"
sha256 "6f11a10b9cd9a2a6480e7c387ea475394262e02b2b1b55269f3df3eb4b70fca0"
revision 1
bottle do
sha256 "ed4bb782f85cd3a74d88cfa584715fe9461f620b3d64648e8955175485b9082a" => :yosemite
sha256 "46cf7c0c7a081119d05172cdee2f0c68f41168a273febd623ec3bcade0f3e5ec" => :mavericks
sha256 "6a83f8d9920adffab06d16601cad43153a138c46a4bd9b4d98aa8c19293d1342" => :mountain_lion
end
option "disable-hipe", "Disable building hipe; fails on various OS X systems"
option "halfword", "Enable halfword emulator (64-bit builds only)"
option "no-docs", "Do not install documentation"
# Detection of odbc header files seems to be broken, so let the formula user
# decide whether or not this is needed.
option "with-odbc", "Build the Erlang odbc application"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "unixodbc" if build.with? "odbc"
depends_on "openssl"
conflicts_with "erlang", :because => "Different version of same formula"
resource "man" do
url "http://erlang.org/download/otp_doc_man_R14B04.tar.gz"
sha256 "8514511e8a8ac3f3f67db06f333548edf283d9a8afcbc9e9eeca7b1af9a107da"
end
resource "html" do
url "http://erlang.org/download/otp_doc_html_R14B04.tar.gz"
sha256 "3b066d23d82667e2d0477856b22ea94262d65baf7366babe1c10d8bddc28ab5a"
end
# This applies a patch from the Erlbrew project
# (https://github.com/mrallen1/erlbrew) that fixes build
# errors with llvm-gcc and clang.
patch :p0, :DATA
def install
ohai "Compilation may take a very long time; use `brew install -v erlang` to see progress"
ENV.deparallelize
# This works in tandem with the erlbrew patch
ENV.append_to_cflags "-DERTS_DO_INCL_GLB_INLINE_FUNC_DEF"
# Do this if building from a checkout to generate configure
system "./otp_build autoconf" if File.exist? "otp_build"
args = ["--disable-debug",
"--prefix=#{prefix}",
"--enable-kernel-poll",
"--enable-threads",
"--enable-dynamic-ssl-lib",
"--enable-shared-zlib",
"--enable-smp-support"]
unless build.include? "disable-hipe"
# HIPE doesn't strike me as that reliable on OS X
# http://syntatic.wordpress.com/2008/06/12/macports-erlang-bus-error-due-to-mac-os-x-1053-update/
# http://www.erlang.org/pipermail/erlang-patches/2008-September/000293.html
args << "--enable-hipe"
end
if MacOS.prefer_64_bit?
args << "--enable-darwin-64bit"
args << "--enable-halfword-emulator" if build.include? "halfword" # Does not work with HIPE yet. Added for testing only
end
# Detection of odbc library and headers is slightly flaky, so be explicit about
# configuring it
args << (build.with?("odbc") ? "--with-odbc" : "--without-odbc")
system "./configure", *args
touch "lib/wx/SKIP" if MacOS.version >= :snow_leopard
system "make"
system "make", "install"
unless build.include? "no-docs"
resource("man").stage { man.install Dir["man/*"] }
resource("html").stage { doc.install Dir["*"] }
end
end
test do
system "#{bin}/erl", "-noshell", "-eval", "crypto:start().", "-s", "init", "stop"
end
end
__END__
--- erts/emulator/beam/beam_bp.c.orig 2011-10-03 13:12:07.000000000 -0500
+++ erts/emulator/beam/beam_bp.c 2013-10-04 13:42:03.000000000 -0500
@@ -496,7 +496,8 @@
}
/* bp_hash */
-ERTS_INLINE Uint bp_sched2ix() {
+#ifndef ERTS_DO_INCL_GLB_INLINE_FUNC_DEF
+ERTS_GLB_INLINE Uint bp_sched2ix() {
#ifdef ERTS_SMP
ErtsSchedulerData *esdp;
esdp = erts_get_scheduler_data();
@@ -505,6 +506,7 @@
return 0;
#endif
}
+#endif
static void bp_hash_init(bp_time_hash_t *hash, Uint n) {
Uint size = sizeof(bp_data_time_item_t)*n;
Uint i;
--- erts/emulator/beam/beam_bp.h.orig 2011-10-03 13:12:07.000000000 -0500
+++ erts/emulator/beam/beam_bp.h 2013-10-04 13:42:08.000000000 -0500
@@ -144,7 +144,19 @@
#define ErtsSmpBPUnlock(BDC)
#endif
-ERTS_INLINE Uint bp_sched2ix(void);
+ERTS_GLB_INLINE Uint bp_sched2ix(void);
+
+#ifdef ERTS_DO_INCL_GLB_INLINE_FUNC_DEF
+ERTS_GLB_INLINE Uint bp_sched2ix() {
+#ifdef ERTS_SMP
+ ErtsSchedulerData *esdp;
+ esdp = erts_get_scheduler_data();
+ return esdp->no - 1;
+#else
+ return 0;
+#endif
+}
+#endif
#ifdef ERTS_SMP
#define bp_sched2ix_proc(p) ((p)->scheduler_data->no - 1)