]>
Commit | Line | Data |
---|---|---|
ecf7d4a4 | 1 | %define somajor 3 |
2 | %define sominor 1 | |
3 | %define sobuild 5 | |
982929a0 | 4 | %define sover %{somajor}.%{sominor}.%{sobuild} |
5e90f260 | 5 | |
ecf7d4a4 | 6 | %define snap 20110218svn6858 |
37bf3af8 | 7 | %define rel 1 |
b8bbb50f AM |
8 | Summary: JavaScript Engine |
9 | Name: v8 | |
982929a0 | 10 | Version: %{somajor}.%{sominor}.%{sobuild}.0 |
c894b44e | 11 | Release: 0.%{snap}.%{rel} |
b8bbb50f AM |
12 | License: BSD |
13 | Group: Libraries | |
14 | URL: http://code.google.com/p/v8 | |
15 | # No tarballs, pulled from svn | |
16 | # svn export http://v8.googlecode.com/svn/trunk/ v8 | |
17 | Source0: %{name}-%{snap}.tar.bz2 | |
ecf7d4a4 | 18 | # Source0-md5: 8ebfa445587a4a649c704d8a20d14ab4 |
5e90f260 | 19 | Patch1: %{name}-2.0.0-d8-allocation.patch |
ffa963bd | 20 | Patch2: %{name}-cstdio.patch |
21 | Patch3: %{name}-strndup.patch | |
982929a0 | 22 | BuildRequires: libstdc++-devel >= 5:4.0 |
7594b47f | 23 | BuildRequires: readline-devel |
b8bbb50f | 24 | BuildRequires: scons |
c894b44e | 25 | ExclusiveArch: %{ix86} %{x8664} arm |
b8bbb50f AM |
26 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
27 | ||
28 | %description | |
29 | V8 is Google's open source JavaScript engine. V8 is written in C++ and | |
30 | is used in Google Chrome, the open source browser from Google. V8 | |
31 | implements ECMAScript as specified in ECMA-262, 3rd edition. | |
32 | ||
37bf3af8 ER |
33 | This package contains the command line program. |
34 | ||
35 | %package libs | |
36 | Summary: V8 JavaScript Engine shared library | |
37 | Group: Libraries | |
38 | Conflicts: v8 < 2.0.0 | |
39 | ||
40 | %description libs | |
41 | V8 is Google's open source JavaScript engine. V8 is written in C++ and | |
42 | is used in Google Chrome, the open source browser from Google. V8 | |
43 | implements ECMAScript as specified in ECMA-262, 3rd edition. | |
44 | ||
45 | This package contains the shared library. | |
46 | ||
b8bbb50f AM |
47 | %package devel |
48 | Summary: Development headers and libraries for v8 | |
49 | Group: Development/Libraries | |
37bf3af8 | 50 | Requires: %{name}-libs = %{version}-%{release} |
b8bbb50f AM |
51 | |
52 | %description devel | |
53 | Development headers and libraries for v8. | |
54 | ||
55 | %prep | |
56 | %setup -q -n %{name} | |
5e90f260 | 57 | %patch1 -p1 |
ffa963bd | 58 | %patch2 -p1 |
59 | %patch3 -p1 | |
7594b47f | 60 | %{__sed} -i -e "s,'-O3','%{rpmcxxflags}'.split(' ')," SConstruct |
b8bbb50f | 61 | |
5e90f260 ER |
62 | # create simple makefile |
63 | cat <<'EOF'> Makefile | |
982929a0 | 64 | V8_OBJS = obj/release/d8-debug.os obj/release/d8-posix.os obj/release/d8-readline.os obj/release/d8.os obj/release/d8-js.os obj/release/extensions/externalize-string-extension.os obj/release/extensions/gc-extension.os |
5e90f260 ER |
65 | V8_LIBS = -lpthread -lreadline -lpthread -L. -lv8 |
66 | ||
67 | v8: | |
68 | $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(V8_OBJS) $(V8_LIBS) | |
69 | EOF | |
70 | ||
b8bbb50f | 71 | %build |
5e90f260 | 72 | # build library |
ffa963bd | 73 | |
74 | CFLAGS="%{rpmcflags}" | |
75 | CXXFLAGS="%{rpmcxxflags}" | |
76 | LDFLAGS="%{rpmcflags}" | |
77 | %if "%{pld_release}" == "ac" | |
78 | CC=%{__cc}4 | |
79 | CXX=%{__cxx}4 | |
80 | %else | |
81 | CC=%{__cc} | |
82 | CXX=%{__cxx} | |
83 | %endif | |
84 | export CFLAGS LDFLAGS CXXFLAGS CC CXX | |
b8bbb50f | 85 | %scons \ |
c894b44e ER |
86 | library=shared \ |
87 | snapshots=on \ | |
7594b47f ER |
88 | soname=off \ |
89 | console=readline \ | |
5e90f260 | 90 | visibility=default \ |
b8bbb50f | 91 | %ifarch x86_64 |
c894b44e | 92 | arch=x64 \ |
b8bbb50f | 93 | %endif |
c894b44e ER |
94 | env=CCFLAGS:"-fPIC" |
95 | ||
7594b47f ER |
96 | # the soname=on creates soname as libv8-1.3.11.1.so, that's wrong |
97 | rm libv8.so | |
b8bbb50f AM |
98 | # Now, lets make it right. |
99 | %ifarch arm | |
ecf7d4a4 | 100 | %{__cxx} %{rpmcflags} %{rpmldflags} -fPIC -o libv8.so.%{sover} -shared -Wl,-soname,libv8.so.%{somajor} obj/release/*.os obj/release/arm/*.os obj/release/extensions/*.os -lpthread |
b8bbb50f AM |
101 | %endif |
102 | %ifarch %{ix86} | |
ecf7d4a4 | 103 | %{__cxx} %{rpmcflags} %{rpmldflags} -fPIC -o libv8.so.%{sover} -shared -Wl,-soname,libv8.so.%{somajor} obj/release/*.os obj/release/ia32/*.os obj/release/extensions/*.os -lpthread |
b8bbb50f | 104 | %endif |
7594b47f | 105 | %ifarch %{x8664} |
ecf7d4a4 | 106 | %{__cxx} %{rpmcflags} %{rpmldflags} -fPIC -o libv8.so.%{sover} -shared -Wl,-soname,libv8.so.%{somajor} obj/release/*.os obj/release/x64/*.os obj/release/extensions/*.os -lpthread |
b8bbb50f AM |
107 | %endif |
108 | ||
5e90f260 ER |
109 | # We need to do this so d8 binary can link against it. |
110 | ln -sf libv8.so.%{sover} libv8.so | |
111 | ||
112 | # build binary | |
113 | %scons d8 \ | |
114 | library=shared \ | |
115 | snapshots=on \ | |
116 | console=readline \ | |
117 | visibility=default \ | |
118 | %ifarch x86_64 | |
119 | arch=x64 \ | |
120 | %endif | |
121 | env=CCFLAGS:"-fPIC" | |
122 | ||
123 | # Sigh. scons links all statically, relink | |
124 | mv d8 d8.static | |
125 | ||
126 | %{__make} v8 \ | |
127 | CXX="%{__cxx}" \ | |
128 | CXXFLAGS="%{rpmcxxflags}" \ | |
129 | LDFLAGS="%{rpmldflags}" | |
130 | ||
b8bbb50f AM |
131 | %install |
132 | rm -rf $RPM_BUILD_ROOT | |
5e90f260 ER |
133 | install -d $RPM_BUILD_ROOT{%{_bindir},%{_includedir},%{_libdir}} |
134 | install -p v8 $RPM_BUILD_ROOT%{_bindir} | |
c894b44e ER |
135 | cp -a include/*.h $RPM_BUILD_ROOT%{_includedir} |
136 | install -p libv8.so.*.*.* $RPM_BUILD_ROOT%{_libdir} | |
b8bbb50f | 137 | |
c894b44e ER |
138 | lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libv8.so.*.*.*) |
139 | ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libv8.so | |
140 | ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libv8.so.0 | |
b8bbb50f AM |
141 | |
142 | %clean | |
143 | rm -rf $RPM_BUILD_ROOT | |
144 | ||
37bf3af8 ER |
145 | %post libs -p /sbin/ldconfig |
146 | %postun libs -p /sbin/ldconfig | |
b8bbb50f AM |
147 | |
148 | %files | |
149 | %defattr(644,root,root,755) | |
150 | %doc AUTHORS ChangeLog LICENSE | |
5e90f260 | 151 | %attr(755,root,root) %{_bindir}/v8 |
37bf3af8 ER |
152 | |
153 | %files libs | |
982929a0 | 154 | %defattr(644,root,root,755) |
c894b44e ER |
155 | %attr(755,root,root) %{_libdir}/libv8.so.*.*.* |
156 | %attr(755,root,root) %ghost %{_libdir}/libv8.so.0 | |
b8bbb50f AM |
157 | |
158 | %files devel | |
159 | %defattr(644,root,root,755) | |
c894b44e | 160 | %attr(755,root,root) %{_libdir}/libv8.so |
b8bbb50f | 161 | %{_includedir}/*.h |