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