Skip to content

Instantly share code, notes, and snippets.

@pwnall
Created June 29, 2012 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwnall/3017424 to your computer and use it in GitHub Desktop.
Save pwnall/3017424 to your computer and use it in GitHub Desktop.
Builder for encap packages for Ruby, the Sass compiler, Node.js and the CoffeeScript compiler
#### node-coffeescript-1.3.3 encap package
## Requires: nodejs-0.8.0
## Set up the encap cage.
# NOTE: this dance ensures that the build process is properly contained
sudo mkdir /usr/local/encap/node-coffeescript-1.3.3
sudo chown $USER:$USER /usr/local/encap/node-coffeescript-1.3.3
## Build and install in the encap cage.
npm cache add coffee-script@1.3.3
cp ~/.npm/coffee-script/1.3.3/package.tgz coffee-script-1.3.3.tar.gz
npm install coffee-script-1.3.3.tar.gz \
--global --prefix /usr/local/encap/node-coffeescript-1.3.3
## Build encap package, lock the cage, and install it in /usr/local.
mkencap node-coffeescript-1.3.3
sudo chown -R root:root /usr/local/encap/node-coffeescript-1.3.3
sudo epkg node-coffeescript-1.3.3
#### nodejs-0.8.0 encap package
## Set up the encap cage.
# NOTE: this dance ensures that the build process is properly contained
sudo mkdir /usr/local/encap/nodejs-0.8.0
sudo chown $USER:$USER /usr/local/encap/nodejs-0.8.0
## Build and install in the encap cage.
wget http://nodejs.org/dist/v0.8.0/node-v0.8.0.tar.gz
tar -xzf node-v0.8.0.tar.gz
cd node-v0.8.0
./configure --prefix=/usr/local/encap/nodejs-0.8.0
make && make install
# NOTE: necessary because node_prefix is compiled into the node executable
./configure --prefix=/usr/local
make
cp out/Release/node /usr/local/encap/nodejs-0.8.0/bin
# NOTE: necessary because npm uses the shebang
sed --in-place --follow-symlinks \
's/\/usr\/local\/encap\/nodejs-0.8.0/\/usr\/local/g' \
/usr/local/encap/nodejs-0.8.0/bin/npm
cd ..
## Build encap package, lock the cage, and install it in /usr/local.
mkencap nodejs-0.8.0
sudo chown -R root:root /usr/local/encap/nodejs-0.8.0/bin
sudo epkg nodejs-0.8.0
#### ruby-1.9.3p194 encap package
## Ruby dependencies.
sudo apt-get install -y libyaml-dev libffi-dev
## Set up the encap cage.
# NOTE: this dance ensures that the build process is properly contained
sudo mkdir /usr/local/encap/ruby-1.9.3p194
sudo chown $USER:$USER /usr/local/encap/ruby-1.9.3p194
## Build and install in the encap cage.
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -xzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194
./configure --prefix=/usr/local/encap/ruby-1.9.3p194 \
--disable-install-doc --enable-shared
make && make install
cd ..
## Configure Rubygems to use the encap-managed shared repository.
# Explanation at http://guides.rubygems.org/command-reference/#gem_environment
mkdir /usr/local/encap/ruby-1.9.3p194/lib/ruby/1.9.1/rubygems/defaults
cat > /usr/local/encap/ruby-1.9.3p194/lib/ruby/1.9.1/rubygems/defaults/operating_system.rb <<EOF
module Gem
def self.default_dir
'/usr/local/lib/ruby/gems/1.9.1'
end
end
EOF
## Build encap package, lock the cage, and install it in /usr/local.
mkencap ruby-1.9.3p194
sudo chown -R root:root /usr/local/encap/ruby-1.9.3p194
sudo epkg ruby-1.9.3p194
#### ruby-sass-3.1.19 encap package
## Requires: ruby-1.9.3p194
## Set up the encap cage.
# NOTE: this dance ensures that the build process is properly contained
sudo mkdir /usr/local/encap/ruby-sass-3.1.19
sudo chown $USER:$USER /usr/local/encap/ruby-sass-3.1.19
## Build and install in the encap cage.
gem fetch sass --version 3.1.19
gem install sass-3.1.19.gem \
--bindir /usr/local/encap/ruby-sass-3.1.19/bin \
--install-dir /usr/local/encap/ruby-sass-3.1.19/lib/ruby/gems/1.9.1 \
--conservative --env-shebang --local --no-rdoc --no-ri
## Build encap package, lock the cage, and install it in /usr/local.
mkencap ruby-sass-3.1.19
sudo chown -R root:root /usr/local/encap/ruby-sass-3.1.19
sudo epkg ruby-sass-3.1.19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment