]>
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 | |
37bf3af8 | 13 | %define rel 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 | ||
37bf3af8 ER |
38 | This package contains the command line program. |
39 | ||
40 | %package libs | |
41 | Summary: V8 JavaScript Engine shared library | |
42 | Group: Libraries | |
43 | Conflicts: v8 < 2.0.0 | |
44 | ||
45 | %description libs | |
46 | V8 is Google's open source JavaScript engine. V8 is written in C++ and | |
47 | is used in Google Chrome, the open source browser from Google. V8 | |
48 | implements ECMAScript as specified in ECMA-262, 3rd edition. | |
49 | ||
50 | This package contains the shared library. | |
51 | ||
b8bbb50f AM |
52 | %package devel |
53 | Summary: Development headers and libraries for v8 | |
54 | Group: Development/Libraries | |
37bf3af8 | 55 | Requires: %{name}-libs = %{version}-%{release} |
b8bbb50f AM |
56 | |
57 | %description devel | |
58 | Development headers and libraries for v8. | |
59 | ||
60 | %prep | |
61 | %setup -q -n %{name} | |
5e90f260 ER |
62 | %patch0 -p1 |
63 | %patch1 -p1 | |
7594b47f | 64 | %{__sed} -i -e "s,'-O3','%{rpmcxxflags}'.split(' ')," SConstruct |
b8bbb50f | 65 | |
5e90f260 ER |
66 | # create simple makefile |
67 | cat <<'EOF'> Makefile | |
68 | 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 | |
69 | V8_LIBS = -lpthread -lreadline -lpthread -L. -lv8 | |
70 | ||
71 | v8: | |
72 | $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(V8_OBJS) $(V8_LIBS) | |
73 | EOF | |
74 | ||
b8bbb50f | 75 | %build |
5e90f260 | 76 | # build library |
b8bbb50f | 77 | %scons \ |
c894b44e ER |
78 | library=shared \ |
79 | snapshots=on \ | |
7594b47f ER |
80 | soname=off \ |
81 | console=readline \ | |
5e90f260 | 82 | visibility=default \ |
b8bbb50f | 83 | %ifarch x86_64 |
c894b44e | 84 | arch=x64 \ |
b8bbb50f | 85 | %endif |
c894b44e ER |
86 | env=CCFLAGS:"-fPIC" |
87 | ||
7594b47f ER |
88 | # the soname=on creates soname as libv8-1.3.11.1.so, that's wrong |
89 | rm libv8.so | |
b8bbb50f AM |
90 | # Now, lets make it right. |
91 | %ifarch arm | |
5e90f260 | 92 | %{__cxx} %{rpmcflags} %{rpmldflags} -fPIC -o libv8.so.%{sover} -shared -Wl,-soname,libv8.so.%{somajor} obj/release/*.os obj/release/arm/*.os -lpthread |
b8bbb50f AM |
93 | %endif |
94 | %ifarch %{ix86} | |
5e90f260 | 95 | %{__cxx} %{rpmcflags} %{rpmldflags} -fPIC -o libv8.so.%{sover} -shared -Wl,-soname,libv8.so.%{somajor} obj/release/*.os obj/release/ia32/*.os -lpthread |
b8bbb50f | 96 | %endif |
7594b47f | 97 | %ifarch %{x8664} |
5e90f260 | 98 | %{__cxx} %{rpmcflags} %{rpmldflags} -fPIC -o libv8.so.%{sover} -shared -Wl,-soname,libv8.so.%{somajor} obj/release/*.os obj/release/x64/*.os -lpthread |
b8bbb50f AM |
99 | %endif |
100 | ||
5e90f260 ER |
101 | # We need to do this so d8 binary can link against it. |
102 | ln -sf libv8.so.%{sover} libv8.so | |
103 | ||
104 | # build binary | |
105 | %scons d8 \ | |
106 | library=shared \ | |
107 | snapshots=on \ | |
108 | console=readline \ | |
109 | visibility=default \ | |
110 | %ifarch x86_64 | |
111 | arch=x64 \ | |
112 | %endif | |
113 | env=CCFLAGS:"-fPIC" | |
114 | ||
115 | # Sigh. scons links all statically, relink | |
116 | mv d8 d8.static | |
117 | ||
118 | %{__make} v8 \ | |
119 | CXX="%{__cxx}" \ | |
120 | CXXFLAGS="%{rpmcxxflags}" \ | |
121 | LDFLAGS="%{rpmldflags}" | |
122 | ||
b8bbb50f AM |
123 | %install |
124 | rm -rf $RPM_BUILD_ROOT | |
5e90f260 ER |
125 | install -d $RPM_BUILD_ROOT{%{_bindir},%{_includedir},%{_libdir}} |
126 | install -p v8 $RPM_BUILD_ROOT%{_bindir} | |
c894b44e ER |
127 | cp -a include/*.h $RPM_BUILD_ROOT%{_includedir} |
128 | install -p libv8.so.*.*.* $RPM_BUILD_ROOT%{_libdir} | |
b8bbb50f | 129 | |
c894b44e ER |
130 | lib=$(basename $RPM_BUILD_ROOT%{_libdir}/libv8.so.*.*.*) |
131 | ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libv8.so | |
132 | ln -s $lib $RPM_BUILD_ROOT%{_libdir}/libv8.so.0 | |
b8bbb50f AM |
133 | |
134 | %clean | |
135 | rm -rf $RPM_BUILD_ROOT | |
136 | ||
37bf3af8 ER |
137 | %post libs -p /sbin/ldconfig |
138 | %postun libs -p /sbin/ldconfig | |
b8bbb50f AM |
139 | |
140 | %files | |
141 | %defattr(644,root,root,755) | |
142 | %doc AUTHORS ChangeLog LICENSE | |
5e90f260 | 143 | %attr(755,root,root) %{_bindir}/v8 |
37bf3af8 ER |
144 | |
145 | %files libs | |
c894b44e ER |
146 | %attr(755,root,root) %{_libdir}/libv8.so.*.*.* |
147 | %attr(755,root,root) %ghost %{_libdir}/libv8.so.0 | |
b8bbb50f AM |
148 | |
149 | %files devel | |
150 | %defattr(644,root,root,755) | |
c894b44e | 151 | %attr(755,root,root) %{_libdir}/libv8.so |
b8bbb50f | 152 | %{_includedir}/*.h |