anvil/tools/build-install-node-from-source.sh
Joshua Harlow 215ccaed49 Remove installing nodejs repo from nodejs.tchol.org
Since said rpm is no longer valid, add a script under
tools to build/install nodejs rpm from source, provide
pre-built nodejs rpm under local-rpms dir and install nodejs
rpm from that dir itself if horizon is being used.

Change-Id: Iae724d73d5433f9de2bd35038edc66c5da185419
2013-03-23 18:52:10 -07:00

58 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -x
nodejs_dir="`pwd`/.nodejs-build-dir"
mkdir $nodejs_dir
cd $nodejs_dir
echo "Downloading http://nodejs.org/dist/node-latest.tar.gz"
wget "http://nodejs.org/dist/node-latest.tar.gz"
tar -xzf node-latest.tar.gz
VERSION=`ls $nodejs_dir/ | grep node-v | cut -d 'v' -f2`
echo $VERSION
cd node-v$VERSION*
export CFLAGS=" -w -pipe -O3"
export CXXFLAGS=" -w -pipe -O3"
./configure --prefix=/usr
echo
echo "Building Node ..."
make
echo
echo "Installing into $nodejs_dir/install-root ..."
mkdir -p "$nodejs_dir/install-root"
make install DESTDIR="$nodejs_dir/install-root"
cd $nodejs_dir
echo
echo "Building RPM ..."
mkdir -p "$nodejs_dir/RPMS"
RELEASE=1
echo "Name: nodejs
Version: $VERSION
Release: $RELEASE
Summary: Server Side JavaScript Engine
URL: http://nodejs.org
Group: Development/Languages
License: MIT and BSD
Requires: openssl, zlib, glibc
%description
Node.js is Google V8 JavaScript with an evented I/O based interface to POSIX. This RPM was built using https://github.com/ddopson/nodejs-rpm-builder
as a reference
%files
%defattr(-,root,root,-)
/" > package.spec
rpmbuild -bb package.spec --buildroot "$nodejs_dir/install-root" --define "_topdir $nodejs_dir" --define "VERSION $VERSION"
yum install -y -q $nodejs_dir/RPMS/x86_64/nodejs-$VERSION-$RELEASE.x86_64.rpm
rm -rf $nodejs_dir