Linux HOWTOs

About | Home | Search


HOWTO: netpbm
Description: A huge pile of graphics conversion utilities (formerly pbmplus)
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# netpbm
# ======
# There are two versions of netpbm in this howto.  The 'advanced' version
# and the 'super-stable' version.  Prior to version 10.35, the 'latest'
# version was available by tarball, but 'advanced' is now only available
# from the Subversion repository.

# Slackware 11.0: netpbm 10.18.12
# Slackware 12.0, 12.1, 12.2: netbmp 10.35.22

# Prerequisites:
# zlib (for pnmtopng and pngtopnm)
# libtiff (for pnmtotiff, tifftopnm, pnmtotiffcmyk)
# libjpeg (for ppmtojpeg, jpegtopnm, ppmtompeg)
# libpng (for pnmtopng and pngtopnm)
# ghostscript (for pstopnm)
# svgalib (for ppmsvgalib)
# Perl (if you use installnetpbm)

# After you're done with this, you might want to replace the included
# pnmtopng/pngtopnm with this other version:
# http://www.libpng.org/pub/png/apps/pnmtopng.html

# To view the docs, run 'manweb netpbm' after installation or go to
# http://netpbm.sf.net/doc/

# If you previously installed netpbm under /usr/local, which is what this
# howto used to do, and you'd rather put it under /usr/local/netpbm, which
# is what this howto does now, compile the new version and when you have the
# new one built under /tmp/netpbm, use that as a guide of what to remove
# under /usr/local.  I used to have the commands required to remove everything
# listed here, but there are hundreds of utils and they change too often for
# me to keep the list here any longer.


# Advanced
# ========
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "netpbm-*" -exec rm -r {} \;
test -d ./netpbm && ( svn up )
test ! -d ./netpbm &&
 svn co https://netpbm.svn.sourceforge.net/svnroot/netpbm/advanced netpbm

# If you cut and paste commands, let the svn one be the last one.  If it
# prompts anything, it will use the next one ("cd netpbm") as your answer to
# the prompt.

cd netpbm

# configure will ask you questions after you run it.  In most cases, you can
# just accept the defaults.  This last time it suggested
# /usr/lib/svgalib/libvga.so for svgalib's library and for me it's:
# /usr/lib/libvga.so instead.
./configure
make

# Become root to install it
su

test -d /tmp/netpbm && rm -r /tmp/netpbm
make package
test -x /sbin/removepkg && /sbin/removepkg libgr netpbm
test -d /usr/local/netpbm && rm -r /usr/local/netpbm
mv /tmp/netpbm /usr/local/netpbm
cd /usr/local/netpbm/lib
ln -sf libnetpbm.so.10.42 libnetpbm.so

# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+w .

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/netpbm-*.tgz
echo 'netpbm advanced was installed from Subversion in ~/src/netpbm' \
 > installed/netpbm.README

# Skip down to "Post-installation" below


# 10.26.60 (super-stable)
# ========
cd
test -f installed/netpbm-10.26.60.tgz && mv installed/netpbm-10.26.60.tgz .
test ! -f netpbm-10.26.60.tgz &&
 wget http://downloads.sf.net/netpbm/netpbm-10.26.60.tgz
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "netpbm-*" -exec rm -r {} \;
tar xzvf ~/netpbm-10.26.60.tgz
cd netpbm-10.26.60
test $UID = 0 && chown -R root:root .

# configure will ask you questions after you run it.  In most cases, you can
# just accept the defaults.
./configure
make

# Become root to install it
su

test -d /tmp/netpbm && rm -r /tmp/netpbm
make package
test -x /sbin/removepkg && /sbin/removepkg libgr netpbm
test -d /usr/local/netpbm && rm -r /usr/local/netpbm
mv /tmp/netpbm /usr/local/netpbm
cd /usr/local/netpbm/lib
ln -sf libnetpbm.so.10.26 libnetpbm.so

# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+w .

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/netpbm-*.tgz
mv netpbm-10.26.60.tgz installed/


# Post-installation
# =================
# Become root
su

# Add /usr/local/netpbm/lib to /etc/ld.so.conf if it's not already in there:
grep "^/usr/local/netpbm/lib$" /etc/ld.so.conf > /dev/null 2>&1 ||
 echo "/usr/local/netpbm/lib" >> /etc/ld.so.conf
ldconfig

# Add /usr/local/netpbm/bin to PATH and /usr/local/netpbm/man to MANPATH.
# Recent versions of Slackware read in files in /etc/profile.d/ when
# /etc/profile is sourced.
echo '#!/bin/sh' > /etc/profile.d/netpbm.sh
echo 'PATH=$PATH:/usr/local/netpbm/bin' >> /etc/profile.d/netpbm.sh
echo 'MANPATH=$MANPATH:/usr/local/netpbm/man' >> /etc/profile.d/netpbm.sh
chmod 755 /etc/profile.d/netpbm.sh

### If yours doesn't do that, either add those settings to /etc/profile
### directly, or add something like this to the bottom of your /etc/profile
### (then it will do that):
## Append any additional sh scripts found in /etc/profile.d/:
#for file in /etc/profile.d/*.sh ; do
#  if [ -x $file ]; then
#    . $file
#  fi
#done

# Run these to add the paths to the PATH and MANPATH in the current shell
# (if they're not already set) and makewhatis will update the whatis database:
echo $PATH | grep "/usr/local/netpbm/bin" > /dev/null 2>&1 ||
 export PATH=$PATH:/usr/local/netpbm/bin
echo $MANPATH | grep "/usr/local/netpbm/man" > /dev/null 2>&1 ||
 export MANPATH=$MANPATH:/usr/local/netpbm/man
makewhatis

# Become yourself again
exit

# Run these to add the paths to the PATH and MANPATH in your non-root shell
# (or logout and login again):
echo $PATH | grep "/usr/local/netpbm/bin" > /dev/null 2>&1 ||
 export PATH=$PATH:/usr/local/netpbm/bin
echo $MANPATH | grep "/usr/local/netpbm/man" > /dev/null 2>&1 ||
 export MANPATH=$MANPATH:/usr/local/netpbm/man

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>