netpbm 10.30 のインストール
2005-12-14 作成 福島
TOP > tips > netpbm-10.30
今回は rpm と make の複合です。


netpbm から呼ばれるライブラリのインストール

$ su
# rpm -i libjpeg-6b-26.i386.rpm
# rpm -i libjpeg-devel-6b-26.i386.rpm
# rpm -i libpng-1.2.2-20.i386.rpm
# rpm -i libpng-devel-1.2.2-20.i386.rpm
# rpm -i libtiff-devel-3.5.7-11.i386.rpm
# exit



netpbm 10.30 のインストール

$ tar zxf netpbm-10.30.tgz
$ cd netpbm-10.30
netpbm-10.30$ ./configure

This is the Netpbm configurator.  It is an interactive dialog that
helps you build the file 'Makefile.config' and prepare to build Netpbm.

Do not be put off by all the questions.  Configure gives you the
opportunity to make a lot of choices, but you don't have to.  If
you don't have reason to believe you're smarter than Configure,
just take the defaults (hit ENTER) and don't sweat it.

If you are considering having a program feed answers to the questions
below, please read doc/INSTALL, because that's probably the wrong thing to do.

Hit ENTER to begin.
[Enter]
Which of the following best describes your platform?
gnu      GNU/Linux
sun      Solaris or SunOS
hp       HP-UX
aix      AIX
win      Windows/DOS (Cygwin, DJGPP, Mingw32)
tru64    Tru64
irix     Irix
bsd      NetBSD, BSD/OS
openbsd  OpenBSD
freebsd  FreeBSD
darwin   Darwin or Mac OS X
amigaos  Amiga
unixware Unixware
sco      SCO OpenServer
beos     BeOS
none     none of these are even close

Platform [gnu] ==> [Enter]

Do you want a regular build or a merge build?
If you don't know what this means, take the default or see doc/INSTALL

regular or merge [regular] ==> [Enter]

Do you want libnetpbm to be statically linked or shared?

static or shared [shared] ==> [Enter]

Do you want to build static libraries too (for linking to
programs not in the Netpbm package?

(y)es or (n)o [y] ==> [Enter]

What header file defines uint32_t, etc.?

(Doing test compiles to choose a default for you -- ignore errors)
Doing test compile: cc -c -o /tmp/netpbm0.o  /tmp/netpbm0.c
/tmp/netpbm0.c:1:19: types.h: そのようなファイルやディレクトリはありません
/tmp/netpbm0.c:2: 構文解析エラー が "testvar" の前にあります
/tmp/netpbm0.c:2: 警告: データ定義が型や記憶クラスを持っていません
Doing test compile: cc -c -o /tmp/netpbm0.o  /tmp/netpbm0.c
/tmp/netpbm0.c:2: 構文解析エラー が "testvar" の前にあります
/tmp/netpbm0.c:2: 警告: データ定義が型や記憶クラスを持っていません
Doing test compile: cc -c -o /tmp/netpbm0.o  /tmp/netpbm0.c

'#include' argument or NONE [] ==> [Enter]
(Doing test compiles to determine if you have int64 type -- ignore errors)
Doing test compile: cc -c -o /tmp/netpbm0.o  /tmp/netpbm0.c
You do.



The following questions concern the subroutine libraries that are Netpbm
prerequisites.  Every library has a compile-time part (header files)
and a link-time part.  In the case of a shared library, these are both
part of the "development" component of the library, which may be separately
installable from the runtime shared library.  For each library, you must
give the filename of the link library.  If it is not in your linker's
default search path, give the absolute pathname of the file.  In addition,
you will be asked for the directory in which the library's interface headers
reside, and you can respond 'default' if they are in your compiler's default
search path.

If you don't have the library on your system, you can enter 'none' as the
library filename and the builder will skip any part that requires that library.

What is your JPEG (graphics format) library?
library filename or 'none' [libjpeg.so] ==> [Enter]
Where are the interface headers for it?
JPEG header directory [default] ==> [Enter]

What is your TIFF (graphics format) library?
library filename or 'none' [libtiff.so] ==> [Enter]
Where are the interface headers for it?
TIFF header directory [default] ==> [Enter]

What is your PNG (graphics format) library?
library filename or 'none' [libpng.so] ==> [Enter]
Where are the interface headers for it?
PNG header directory [default] ==> [Enter]

What is your Z (compression) library?
library filename or 'none' [libz.so] ==> [Enter]
Where are the interface headers for it?
Z header directory [default] ==> [Enter]

Cannot find the include files for SVGALIB.  Enter the directory where they reside, or none.
  If none, a default make will not build programs that require the SVGALIB library.
Svgalib header location (none)=> [Enter]

What URL will you use for the main Netpbm documentation page?
This information does not get built into any programs or libraries.
It does not make anything actually install that web page.
It is just for including in legacy man pages.

Documentation URL [http://netpbm.sourceforge.net/doc/] ==> [Enter]

Doing test compile: cc -c -o /tmp/netpbm0.o   /tmp/netpbm0.c
Doing test compile: cc -c -o /tmp/netpbm0.o   /tmp/netpbm0.c
Doing test compile: cc -c -o /tmp/netpbm0.o   /tmp/netpbm0.c
Doing test compile: cc -c -o /tmp/netpbm0.o    /tmp/netpbm0.c

We have created the file 'Makefile.config'.  Note, however, that
we guessed a lot at your configuration and you may want to look
at Makefile.config and edit it to your requirements and taste
before doing the make.

Now you may proceed with 'make'
netpbm-10.30$ make
netpbm-10.30$ make package pkgdir=/tmp/netpbm
netpbm-10.30$ su
netpbm-10.30# ./installnetpbm
netpbm-10.30# exit



shared library を認識させる

$ su
# cat >> /etc/ld.so.conf
/usr/local/netpbm/lib
^D
# /sbin/ldconfig
# exit



netpbm コマンドへのパスを設定する

$ cat >> ~/.bash_profile
PATH=$PATH:/usr/local/netpbm/bin
^D



・P1〜P6 の意味
Pn 0000 0xxx
         |++- 0:PBM (Portable BitMap)    白黒 2 値画像
         |    1:PGM (Portable GrayMap)   グレイスケール画像
         |    2:PPM (Portable PixcelMap) カラー画像
         |
         +--- 0:テキスト 1:バイナリ

PNM (Portable AnyMap) は PBM,PGM,PPM のいずれかを指す。
・24 ビット bmp から 2 値 bmp を生成する

$ bmptoppm 24bitColor.bmp | ppmquant 2 | ppmtobmp > monocrome.bmp