]> git.pld-linux.org Git - packages/nodejs.git/blob - nodejs.spec
37155273159197d4c95dcba0bcf580e41b6426a0
[packages/nodejs.git] / nodejs.spec
1 Summary:        Asynchronous JavaScript Engine
2 Name:           nodejs
3 Version:        0.6.19
4 Release:        1
5 License:        BSD and MIT and ASL 2.0 and GPLv3
6 Group:          Development/Languages
7 URL:            http://www.nodejs.org/
8 Source0:        http://nodejs.org/dist/v%{version}/node-v%{version}.tar.gz
9 # Source0-md5:  f5669a9717422b811c6bad1cc961b1e5
10 Patch1:         %{name}-soname.patch
11 # force node to use /usr/lib/node as the systemwide module directory
12 Patch2:         %{name}-libpath.patch
13 # use /usr/lib64/node as an arch-specific module dir when appropriate
14 Patch3:         %{name}-lib64path.patch
15 # Fix linking of zlib
16 Patch4:         %{name}-shared-zlib.patch
17 Patch5:         uv-fpic.patch
18 BuildRequires:  c-ares-devel >= 1.7.4
19 BuildRequires:  gcc >= 5:4.0
20 BuildRequires:  libeio-devel
21 BuildRequires:  libev-devel >= 4.0.0
22 BuildRequires:  libstdc++-devel
23 BuildRequires:  python >= 1:2.5.2
24 BuildRequires:  python-jsmin
25 BuildRequires:  rpm >= 4.4.9-56
26 BuildRequires:  rpmbuild(macros) >= 1.219
27 BuildRequires:  v8-devel >= 3.6
28 ExclusiveArch:  %{ix86} %{x8664} arm
29 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
30
31 %description
32 Node.js is a platform built on Chrome's JavaScript runtime for easily
33 building fast, scalable network applications. Node.js uses an
34 event-driven, non-blocking I/O model that makes it lightweight and
35 efficient, perfect for data-intensive real-time applications that run
36 across distributed devices.
37
38 %package devel
39 Summary:        Development headers for nodejs
40 Group:          Development/Libraries
41 Requires:       %{name} = %{version}-%{release}
42 Requires:       %{name}-waf = %{version}-%{release}
43 Requires:       gcc
44 Requires:       libstdc++-devel
45 Requires:       v8-devel
46
47 %description devel
48 Development headers for nodejs.
49
50 %package doc
51 Summary:        Evented I/O for V8 JavaScript - documentation
52 Group:          Documentation
53
54 %description doc
55 Node.js is a server-side JavaScript environment that uses an
56 asynchronous event-driven model. Node's goal is to provide an easy way
57 to build scalable network programs.
58
59 This package contains the documentation for nodejs.
60
61 %package waf
62 Summary:        Evented I/O for V8 JavaScript - customized WAF build system
63 Group:          Libraries
64 Requires:       %{name} = %{version}-%{release}
65
66 %description waf
67 Node.js is a server-side JavaScript environment that uses an
68 asynchronous event-driven model. Node's goal is to provide an easy way
69 to build scalable network programs.
70
71 This package contains the customized version of the WAF build system
72 used by Node.js and many of its modules.
73
74 %prep
75 %setup -q -n node-v%{version}
76 %patch1 -p1
77 %if %{_lib} == "lib64"
78 %patch3 -p1
79 %else
80 %patch2 -p1
81 %endif
82 %patch4 -p1
83 %patch5 -p1
84
85 # fix #!/usr/bin/env python -> #!/usr/bin/python:
86 grep -rl 'bin/env python' tools | xargs %{__sed} -i -e '1s,^#!.*python,#!%{__python},'
87
88 %build
89 CFLAGS="%{rpmcflags} -fPIC"
90 CPPFLAGS="%{rpmcppflags} -fPIC"
91 CXXFLAGS="%{rpmcxxflags} -fPIC"
92 LDFLAGS="%{rpmcflags}"
93 %if "%{pld_release}" == "ac"
94 CC="%{__cc}4"
95 CXX="%{__cxx}4"
96 %else
97 CC="%{__cc}"
98 CXX="%{__cxx}"
99 %endif
100 export CFLAGS LDFLAGS CXXFLAGS CC CXX LINKFLAGS_UV
101
102 # Error: V8 doesn't like ccache. Please set your CC env var to 'gcc'
103 CC=${CC#ccache }
104
105 # NOT autoconf so dont use macro
106 export PYTHONPATH=tools
107 ./configure \
108         --shared-cares \
109         --shared-v8 \
110         --shared-zlib \
111         --without-npm \
112         --libdir=%{_libdir} \
113         --prefix=%{_prefix}
114
115 # build library
116 %{__make} dynamiclib
117 %{__make} program
118
119 # relink with shared lib
120 $CC -o out/Release/node src/node_main.cc -Isrc -Ideps/uv/include -lnode -Lout/Release
121
122 %install
123 rm -rf $RPM_BUILD_ROOT
124 %{__make} install \
125         DESTDIR=$RPM_BUILD_ROOT
126
127 # for compat of fedora derivered scripts (shebangs)
128 ln -s node $RPM_BUILD_ROOT%{_bindir}/nodejs
129
130 # globally installed node modules (noarch)
131 install -d $RPM_BUILD_ROOT%{_prefix}/lib/node_modules
132
133 # default searchpaths
134 install -d $RPM_BUILD_ROOT{%{_libdir},%{_prefix}/lib}/node
135
136 # install shared lib
137 export PYTHONPATH=tools
138 %{__python} tools/waf-light install \
139         --product-type=cshlib \
140         --destdir=$RPM_BUILD_ROOT
141
142 chmod a+x $RPM_BUILD_ROOT%{_libdir}/*.so*
143
144 # create pkgconfig
145 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
146 cat <<'EOF' > $RPM_BUILD_ROOT%{_pkgconfigdir}/%{name}.pc
147 version=%{version}
148 prefix=%{_prefix}
149 libdir=${prefix}/%{_lib}
150 includedir=${prefix}/include/node
151
152 Name: nodejs
153 Description: Evented I/O for V8 JavaScript.
154 Version: ${version}
155 Cflags: -I${includedir}
156 EOF
157
158 %py_ocomp $RPM_BUILD_ROOT%{_libdir}/node/wafadmin
159 %py_comp $RPM_BUILD_ROOT%{_libdir}/node/wafadmin
160 # TODO: check it first
161 #%%py_postclean %{_libdir}/node/wafadmin
162
163 # install documentation
164 install -d $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
165 cp -a doc/api/* $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}
166 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.markdown
167 rm $RPM_BUILD_ROOT%{_docdir}/%{name}-doc-%{version}/*.json
168
169 %clean
170 rm -rf $RPM_BUILD_ROOT
171
172 %post   -p /sbin/ldconfig
173 %postun -p /sbin/ldconfig
174
175 %files
176 %defattr(644,root,root,755)
177 %doc README.md AUTHORS ChangeLog LICENSE
178 %attr(755,root,root) %{_bindir}/node
179 %attr(755,root,root) %{_bindir}/nodejs
180 %attr(755,root,root) %{_libdir}/libnode.so.*.*.*
181 %ghost %{_libdir}/libnode.so.6
182 %dir %{_libdir}/node
183 %dir %{_prefix}/lib/node
184 %dir %{_prefix}/lib/node_modules
185 %{_mandir}/man1/node.1*
186
187 %files devel
188 %defattr(644,root,root,755)
189 %{_libdir}/libnode.so
190 %{_includedir}/node
191 %{_pkgconfigdir}/nodejs.pc
192
193 %files doc
194 %defattr(644,root,root,755)
195 %doc %{_docdir}/%{name}-doc-%{version}
196
197 %files waf
198 %defattr(644,root,root,755)
199 %attr(755,root,root) %{_bindir}/node-waf
200 %dir %{_libdir}/node/wafadmin
201 %dir %{_libdir}/node/wafadmin/Tools
202 %{_libdir}/node/wafadmin/*.py[co]
203 %{_libdir}/node/wafadmin/*.py
204 %{_libdir}/node/wafadmin/Tools/*.py
205 %{_libdir}/node/wafadmin/Tools/*.py[co]
This page took 0.830278 seconds and 2 git commands to generate.