Skip to content

Instantly share code, notes, and snippets.

@charles-dyfis-net
Created March 1, 2011 12:15
Show Gist options
  • Save charles-dyfis-net/849047 to your computer and use it in GitHub Desktop.
Save charles-dyfis-net/849047 to your computer and use it in GitHub Desktop.
node.js spec for CentOS 5
#node is an already known package. node.js have dot in name, so "nodejs"
#is a better name
#some ideas are taken from
#http://blog.fpmurphy.com/2010/12/node-js-and-npm-on-fedora-14.html
Name: nodejs
Version: 0.4.0
Release: 0%{?dist}
Summary: JavaScript server-side network application development
Group: Development/Languages/Other
License: MIT
URL: http://nodejs.org/
Source0: http://nodejs.org/dist/node-v%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: gcc-c++ libstdc++-devel python openssl-devel
%description
Evented I/O for Google V8 JavaScript
Node use V8 engine (JavaScript engine used for Webkit) and let you create
application on server-side. It handles HTTP server, Socket server, clients
and a lot of modules to ease your projects creation.
Node's goal is to provide an easy way to build scalable network programs.
%package devel
Summary: Node.js development files
Group: Development/Languages/C and C++
Requires: %{name} = %{version}-%{release}
Requires: python
#required because gcc is use to create modules shared object
Requires: gcc-c++
%description devel
This package contains files for node.js modules development
%clean
rm -rf $RPM_BUILD_ROOT
%prep
%setup -q -n node-v%{version}
%build
./configure --debug --prefix=%{_prefix}
sed -i -e 's/"lib", "node"/"lib", "nodejs"/g' src/node.js
make %{?_smp_mflags} CXXFLAGS="%{optflags}" CFLAGS="%{optflags}"
%install
make DESTDIR=%{buildroot} install
#change path, "node" is ani already known package and this can be confused
#to let "node" name
mv $RPM_BUILD_ROOT%{_bindir}/node $RPM_BUILD_ROOT%{_bindir}/nodejs
mv $RPM_BUILD_ROOT%{_bindir}/node_g $RPM_BUILD_ROOT%{_bindir}/nodejs_g
#mv $RPM_BUILD_ROOT%{_includedir}/node $RPM_BUILD_ROOT%{_includedir}/nodejs
#mv $RPM_BUILD_ROOT%{_prefix}/lib/node $RPM_BUILD_ROOT%{_prefix}/lib/nodejs
mv $RPM_BUILD_ROOT%{_mandir}/man1/node.1 $RPM_BUILD_ROOT%{_mandir}/man1/nodejs.1
# make sure this artifact of build system jiggery-pokery is dead
rm -rf $RPM_BUILD_ROOT/%{_prefix}/lib/nodejs/node/wafadmin
#should not be executables, wafadmin tools are included by bin/nodewaf calls
find $RPM_BUILD_ROOT/%{_prefix}/lib/node* -type f -name "*.py" -exec chmod a-x {} \;
%files
%defattr(-,root,root,-)
%doc doc README.md README.cmake LICENSE AUTHORS
%attr(755,root,root) %{_bindir}/nodejs
%{_mandir}/man1/nodejs.1.gz
%files devel
%defattr(-,root,root,-)
%attr(755,root,root) %{_bindir}/nodejs_g
%{_includedir}/node*
%{_prefix}/lib/pkgconfig/nodejs.pc
#wafadmin tools
%attr(755,root,root) %{_bindir}/node-waf
%{_prefix}/lib/node*
%changelog
* Wed Jan 19 2011 Patrice (Metal3d) Ferlet <[email protected]> 0.2.6-3
- libs are javascript files and have not arch dependecies
- add libs packages (noarch)
- removes some double listed files
- add doc directory to %doc
* Wed Jan 19 2011 Patrice (Metal3d) Ferlet <[email protected]> 0.2.6-2
- change Group to Development/Languages
* Tue Jan 6 2011 Patrice Ferlet <[email protected]> 0.2.6-1
- initial package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment