PackageMakeInstall

Tyler edited this page Jun 13, 2015 · 9 revisions

Use Case - Package something that uses 'make install'

This requires your 'make install' obey DESTDIR or otherwise allows you to install to a specific target directory.

In this example, I will make 3 node packages from nodejs: nodejs, nodejs-dev, and nodejs-doc

Package up the nodejs runtime

Normal build steps.

# Normal build steps.
% wget http://nodejs.org/dist/v0.6.0/node-v0.6.0.tar.gz
% tar -zxf node-v0.6.0.tar.gz
% cd node-v0.6.0
% ./configure --prefix=/usr
% make

Now install it.

# Install to a separate directory for capture.
% mkdir /tmp/installdir
% make install DESTDIR=/tmp/installdir

Now make the 'nodejs' package

# Create a nodejs deb with only bin and lib directories:
# The 'VERSION' and 'ARCH' strings are automatically filled in for you
# based on the other arguments given.
% fpm -s dir -t deb -n nodejs -v 0.6.0 -C /tmp/installdir \
  -p nodejs_VERSION_ARCH.deb \
  -d "libssl0.9.8 > 0" \
  -d "libstdc++6 >= 4.4.3" \
  usr/bin usr/lib

Install the package, test it out:

# 'fpm' just produced us a nodejs deb:
% file nodejs_0.6.0-1_amd64.deb
nodejs_0.6.0-1_amd64.deb: Debian binary package (format 2.0)
% sudo dpkg -i nodejs_0.6.0-1_amd64.deb 

% /usr/bin/node --version
v0.6.0

Package up the manpages (create nodejs-doc)

# Create a package of the node manpage
% fpm -s dir -t deb -p nodejs-doc_VERSION_ARCH.deb -n nodejs-doc -v 0.6.0 -C /tmp/installdir usr/share/man

Look in the nodejs-doc package:

% dpkg -c nodejs-doc_0.6.0-1_amd64.deb| grep node.1
-rw-r--r-- root/root       945 2011-01-02 18:35 usr/share/man/man1/node.1

Now create the -dev package:

% fpm -s dir -t deb -p nodejs-dev_VERSION_ARCH.deb -n nodejs-dev -v 0.6.0 -C /tmp/installdir usr/include  
% dpkg -c nodejs-dev_0.6.0-1_amd64.deb | grep -F .h 
-rw-r--r-- root/root     14359 2011-01-02 18:33 usr/include/node/eio.h
-rw-r--r-- root/root      1118 2011-01-02 18:33 usr/include/node/node_version.h
-rw-r--r-- root/root     25318 2011-01-02 18:33 usr/include/node/ev.h
...

Voila.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.