]>
Commit | Line | Data |
---|---|---|
c8c14515 | 1 | # TODO |
7594b47f ER |
2 | # - cxx is not passed to build |
3 | # - cleaner way for cxxflags | |
5e90f260 ER |
4 | |
5 | # For the 1.2 branch, we use 0s here | |
6 | # For 1.3+, we use the three digit versions | |
7 | %define somajor 2 | |
8 | %define sominor 0 | |
9 | %define sobuild 0 | |
10 | %define sover %{somajor}.%{sominor}.%{sobuild} | |
11 | ||
12 | %define snap 20091118svn3334 | |
13 | %define rel 0.1 | |
b8bbb50f AM |
14 | Summary: JavaScript Engine |
15 | Name: v8 | |
5e90f260 | 16 | Version: 2.0.0 |
c894b44e | 17 | Release: 0.%{snap}.%{rel} |
b8bbb50f AM |
18 | License: BSD |
19 | Group: Libraries | |
20 | URL: http://code.google.com/p/v8 | |
21 | # No tarballs, pulled from svn | |
22 | # svn export http://v8.googlecode.com/svn/trunk/ v8 | |
23 | Source0: %{name}-%{snap}.tar.bz2 | |
5e90f260 ER |
24 | # Source0-md5: 014dd59b50b7859f3845b535ebd06ad2 |
25 | Patch0: %{name}-d8-fwrite-return.patch | |
26 | Patch1: %{name}-2.0.0-d8-allocation.patch | |
54ff92d3 | 27 | BuildRequires: libstdc++-devel |
7594b47f | 28 | BuildRequires: readline-devel |
b8bbb50f | 29 | BuildRequires: scons |
c894b44e | 30 | ExclusiveArch: %{ix86} %{x8664} arm |
b8bbb50f AM |
31 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
32 | ||
33 | %description | |
34 | V8 is Google's open source JavaScript engine. V8 is written in C++ and | |
35 | is used in Google Chrome, the open source browser from Google. V8 | |
36 | implements ECMAScript as specified in ECMA-262, 3rd edition. | |
37 | ||
38 | %package devel | |
39 | Summary: Development headers and libraries for v8 | |
40 | Group: Development/Libraries | |
41 | Requires: %{name} = %{version}-%{release} | |
42 | ||
43 | %description devel | |
44 | Development headers and libraries for v8. | |
45 | ||
46 | %prep | |
47 | %setup -q -n %{name} | |
5e90f260 ER |
48 | %patch0 -p1 |
49 | %patch1 -p1 | |
7594b47f | 50 | %{__sed} -i -e "s,'-O3','%{rpmcxxflags}'.split(' ')," SConstruct |
b8bbb50f | 51 | |
5e90f260 ER |
52 | # create simple makefile |
53 | cat <<'EOF'> Makefile | |
54 | 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 | |
55 | V8_LIBS = -lpthread -lreadline -lpthread -L. -lv8 | |
56 | ||
57 | v8: | |
58 | $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(V8_OBJS) $(V8_LIBS) | |
59 | EOF | |
60 | ||
b8bbb50f | 61 | %build |
5e90f260 | 62 | # build library |
b8bbb50f | 63 | %scons \ |
c894b44e ER |
64 | library=shared \ |
65 | snapshots=on \ | |
7594b47f ER |
66 | soname=off \ |
67 | console=readline \ | |
5e90f260 | 68 | visibility=default \ |
b8bbb50f | 69 | %ifarch x86_64 |
c894b44e | 70 | arch=x64 \ |
b8bbb50f | 71 | %endif |
c894b44e ER |
72 | env=CCFLAGS:"-fPIC" |
73 | ||
7594b47f ER |
74 | # the soname=on creates soname as libv8-1.3.11.1.so, that's wrong |
75 | rm libv8.so | |
b8bbb50f AM |
76 | # Now, lets make it right. |
77 | %ifarch arm | |
5e90f260 | 78 | %{__cxx} %{rpmcflags} %{rpmldflags} -fPIC -o libv8.so.%{sover} -shared -Wl,-soname,libv8.so.%{somajor} obj/release/*.os obj/release/arm/*.os -lpthread |
b8bbb50f AM |
79 | %endif |
80 | %ifarch %{ix86} | |
5e90f260 | 81 | %{__cxx} %{rpmcflags} %{rpmldflags} -fPIC -o libv8.so.%{sover} -shared -Wl,-soname,libv8.so.%{somajor} obj/release/*.os obj/release/ia32/*.os -lpthread |
b8bbb50f | 82 | %endif |
7594b47f | 83 | %ifarch %{x8664} |
5e90f260 | 84 | %{__cxx} %{rpmcflags} %{rpmldflags} -fPIC -o libv8.so.%{sover} -shared -Wl,-soname,libv8.so.%{somajor} obj/release/*.os obj/release/x64/*.os -lpthread |
b8bbb50f AM |
85 | %endif |
86 | ||
5e90f260 ER |
87 | # We need to do this so d8 binary can link against it. |
88 | ln -sf libv8.so.%{sover} libv8.so | |
89 | ||
90 | # build binary | |
91 | %scons d8 \ | |
92 | library=shared \ | |
93 | snapshots=on \ | |
94 | console=readline \ | |
95 | visibility=default \ | |
96 | %ifarch x86_64 | |
97 | arch=x64 \ | |
98 | %endif | |
99 | env=CCFLAGS:"-fPIC" | |
100 | ||
101 | # Sigh. scons links all statically, relink | |
102 | mv d8 d8.static | |
103 | ||
104 | %{__make} v8 \ | |
105 | CXX="%{__cxx}" \ | |
106 | CXXFLAGS="%{rpmcxxflags}" \ | |
107 | LDFLAGS="%{rpmldflags}" | |
108 | ||
b8bbb50f AM |
109 | %install |
110 | rm -rf $RPM_BUILD_ROOT | |
5e90f260 ER |
111 | install -d $RPM_BUILD_ROOT{%{_bindir},%{_includedir},%{_libdir}} |
112 | install -p v8 $RPM_BUILD_ROOT%{_bindir} | |
c894b44e ER |
113 | cp -a include/*.h $RPM_BUILD_ROOT%{_includedir} |
114 | install -p libv8.so.*.*.* $RPM_BUILD_ROOT%{_libdir} | |
b8bbb50f | 115 | |
c894b44e ER |
116 | lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libv8.so.*.*.*) |
117 | ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libv8.so | |
118 | ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libv8.so.0 | |
b8bbb50f AM |
119 | |
120 | %clean | |
121 | rm -rf $RPM_BUILD_ROOT | |
122 | ||
c894b44e ER |
123 | %post -p /sbin/ldconfig |
124 | %postun -p /sbin/ldconfig | |
b8bbb50f AM |
125 | |
126 | %files | |
127 | %defattr(644,root,root,755) | |
128 | %doc AUTHORS ChangeLog LICENSE | |
5e90f260 | 129 | %attr(755,root,root) %{_bindir}/v8 |
c894b44e ER |
130 | %attr(755,root,root) %{_libdir}/libv8.so.*.*.* |
131 | %attr(755,root,root) %ghost %{_libdir}/libv8.so.0 | |
b8bbb50f AM |
132 | |
133 | %files devel | |
134 | %defattr(644,root,root,755) | |
c894b44e | 135 | %attr(755,root,root) %{_libdir}/libv8.so |
b8bbb50f | 136 | %{_includedir}/*.h |