From 04afde0b11367018d95be801c543fdcf16420b5d Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 30 Mar 2014 17:12:47 +0000 Subject: Update to current Development release - 10.66.00 git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@2172 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- buildtools/README.pkg | 70 ++++-- buildtools/configure.pl | 58 ++++- buildtools/debian/README | 122 ++++++++++ buildtools/debian/mkdeb | 541 +++++++++++++++++++++++++++++++++++++++++++++ buildtools/debian/postinst | 5 + buildtools/debian/postrm | 5 + 6 files changed, 775 insertions(+), 26 deletions(-) create mode 100644 buildtools/debian/README create mode 100755 buildtools/debian/mkdeb create mode 100755 buildtools/debian/postinst create mode 100755 buildtools/debian/postrm (limited to 'buildtools') diff --git a/buildtools/README.pkg b/buildtools/README.pkg index e544cbb7..f098e04b 100644 --- a/buildtools/README.pkg +++ b/buildtools/README.pkg @@ -111,15 +111,26 @@ The parts to be installed are: One of the Netpbm programs is Manweb, which is designed to be a - replacement for the classic Man program that can access both - traditional man pages and worldwide web documentation in the - Netpbm style with the familiar 'man jpegtopnm' kind of command. - To set up your system for this, you will have to be sure to create - the /usr/man/web directory, with 'netpbm.url' in it. Also, If you - install Manweb as 'man', there is no point to installing the + replacement for the classic Man program that can access both traditional + man pages and worldwide web documentation in the Netpbm style with the + familiar 'man jpegtopnm' kind of command. The package contains the files + necessary to use Manweb to access Netpbm documention on the web (on + netpbm.sourceforge.net). These files are the contents of the man/web + directory and the file 'bin/doc.url'. You should install the + 'bin/doc.url' file if you are installing the Netpbm executables in a + directory all their own. You should install the 'man/web' files if you + are installing the Netpbm executables in some global directory such as + 'usr/bin'. You should install neither of these if you don't intend to use + Manweb. + + If you install Manweb as 'man', there is no point to installing the pointer man pages -- they will never be used. - + If you want to use Manweb to view the Netpbm manual but use a local + copy of the manual instead of accessing it on the web, you can get the + HTML files from the Sourceforge Subversion repository and install those + instead of the .url files that appear in the 'man/web' directory of the + package. The instructions above suggest putting the Netpbm parts in common directories such as /usr/bin, mingled with other packages. This is @@ -134,21 +145,34 @@ entire installation when you don't want it anymore, and to keep multiple versions around. -netpbm.config +netpbm.pkgconfig +---------------- + +You should create a file named 'netpbm.pkgconfig' out of the template file +'pkgconfig_template' in the package directory, and install netpbm.pkgconfig in +your pkg-config directory (typically /usr/lib/pkgconfig). Programs that want +to find out where you installed some part of Netpbm can use a 'pkg-config +netpbm ...' command to find out. For example, a make file for a program that +uses the Netpbm programming library might use this facility to generate the +necessary compiler and linker options to access that library. + +The pkg-config facility is fairly widely used, especially with things related +to the X Window System. + + +netpbm-config ------------- -You should create a shell script named 'netpbm.config' out of the -template file 'config_template' in the package directory, and install -netpbm.config in your executable search path. Programs that want to -find out where you installed some part of Netpbm can invoke -netpbm.config and it will tell them. For example, a make file for a -program that uses the Netpbm programming library might use -netpbm.config to generate the necessary compiler and linker options to -access that library. - -Using netpbm.config, it's possible to have a viable Netpbm -installation where netpbm.config is the only file in any default -search path. - -The xxx.config file concept is a relatively new but growing convention, -seen mostly in software related to the X Window System. +You should create a shell script named 'netpbm-config' out of the template +file 'config_template' in the package directory, and install netpbm-config in +your executable search path. Programs that want to find out where you +installed some part of Netpbm can invoke netpbm-config and it will tell them. +For example, a make file for a program that uses the Netpbm programming +library might use netpbm-config to generate the necessary compiler and linker +options to access that library. + +Using netpbm-config, it's possible to have a viable Netpbm installation where +netpbm.config is the only file in any default search path. + +The xxx-config concept (in general, not just Netpbm) has largely been replaced +by the pkg-config concept (see netpbm.pkgconfig above). diff --git a/buildtools/configure.pl b/buildtools/configure.pl index b03630d8..d4e9bee3 100755 --- a/buildtools/configure.pl +++ b/buildtools/configure.pl @@ -353,7 +353,7 @@ sub testCompile($$$) { sub testCompileLink($$$) { my ($flags, $cSourceCodeR, $successR) = @_; #----------------------------------------------------------------------------- -# Do a test compile of the program in @{$cSourceCodeR}. +# Do a test compile and link of the program in @{$cSourceCodeR}. # # Return $$successR == $TRUE iff the compile succeeds (exit code 0). #----------------------------------------------------------------------------- @@ -1629,6 +1629,56 @@ sub testJpegHdr($) { +sub warnJpegNotInDefaultPath($) { + my ($jpegLib) = @_; + + print("You said your JPEG library is '$jpegLib', which says it is " + . "in the linker's default search path, but a test link we did " + . "failed as if it is not. If it isn't, the build will fail\n"); +} + + + +sub testJpegLink($) { + my ($jpegLib) = @_; +#----------------------------------------------------------------------------- +# See if we can link the JPEG library with the information user gave us. +# $jpegLib is the answer to the "what is your JPEG library" prompt, so +# it is either a library file name such as "libjpeg.so", in the linker's +# default search path, or it is an absolute path name such as +# "/usr/jpeg/lib/libjpeg.so". +# +# We actually test only the default search path case, since users often +# incorrectly specify that by taking the default. +#----------------------------------------------------------------------------- + if ($jpegLib =~ m{( lib | cyg ) (.+) \. ( so | a )$}x) { + my $libName = $2; + + # It's like "libjpeg.so", so is a library in the default search path. + # $libName is "jpeg" in this example. + + # First we test our test tool. We can do this only with GCC. + + my @emptySource; + + testCompileLink('-nostartfiles', \@emptySource, \my $controlWorked); + + if ($controlWorked) { + # The "control" case worked. Now see if it still works when we add + # the JPEG library. + + testCompileLink("-nostartfiles -l$libName", \@emptySource, + \my $workedWithJpeg); + + if (!$workedWithJpeg) { + warnJpegNotInDefaultPath($jpegLib); + } + } + } +} + + + sub testCompileZlibH($$) { my ($cflags, $successR) = @_; #----------------------------------------------------------------------------- @@ -1895,6 +1945,8 @@ sub testConfiguration($$$$$$) { if (defined($jpeglib)) { testJpegHdr($jpeghdr_dir); + + testJpegLink($jpeglib); } if (defined($pnglib) && defined($zlib)) { testPngHdr($pnghdr_dir, $zhdr_dir); @@ -2289,7 +2341,7 @@ if ($platform eq "GNU") { # only Ppmtompeg and it isn't clear that using long instead of int is # ever right anyway. - push(@config_mk, "OMIT_NETWORK = y\n"); + push(@config_mk, "OMIT_NETWORK = Y\n"); push(@config_mk, "LINKER_CAN_DO_EXPLICIT_LIBRARY=Y\n"); } elsif ($platform eq "IRIX") { # push(@config_mk, "INSTALL = install\n"); @@ -2303,7 +2355,7 @@ if ($platform eq "GNU") { makeCompilerGcc(\@config_mk); } push(@config_mk, "EXE = .exe\n"); - push(@config_mk, "OMIT_NETWORK = y\n"); + push(@config_mk, "OMIT_NETWORK = Y\n"); # # Though it may not have the link as "ginstall", "install" in a Windows # # Unix environment is usually GNU install. # my $ginstall_result = `ginstall --version 2>/dev/null`; diff --git a/buildtools/debian/README b/buildtools/debian/README new file mode 100644 index 00000000..1c600c6b --- /dev/null +++ b/buildtools/debian/README @@ -0,0 +1,122 @@ +Files in this directory are for creating a Debian package (.deb file), +which one can use to install Netpbm on a Debian system (or a system running +a derivative of Debian, such as Ubuntu or Mint). + +You can of course install on one of these systems by running 'installnetpbm', +or otherwise inserting all the files in the proper place in your system file +tree, but having a Debian package allows you to manage those files using +Debian's normal package management. The package management system will know +where the Netpbm files came from, and you can upgrade or remove Netpbm easily. +The package management system will also be aware of prerequisites of Netpbm +and ensure that you don't have Debian's own inferior version of Netpbm +installed (which would cause conflicts). + +The package we create is named 'netpbm-sf' (where the "sf" is from +"SourceForge"), to be distinct from the package named "netpbm" which is part +of Debian. + +To install Netpbm as a Debian package: + + 1) Follow the regular instructions to build and package Netpbm + (configure, make, make package). + + 2) With the root of the built Netpbm build tree as your current + directory: + + $ make deb + + (This defaults to getting Netpbm from /tmp/netpbm, which is also where + 'make package' defaults to putting it). + + 3) $ dpkg --install netpbm-sfXXXX.deb + + (netpbm-sfXXXX.deb is the file created by 'makedeb', in the current + directory). + + +PREREQUSISITES +-------------- + +The following information was taken from the Wheezy version of Debian, in +January 2014. + +You don't actually need the current version of any of these. For example, +while we list package libjpeg8-dev, the package libjpeg62-dev works fine. + + +Building +-------- + +You need the following Debian packages to build all of Netpbm. + +You could omit some of these and, in the Netpbm build configuration dialog, +indicate you don't have them, and the build will simply omit some parts. +For example, if you don't install libx11-dev, the Netpbm build process +will not build the 'pamx' program. + + libjpeg8-dev + libpng12-0-dev + libsvga1-dev + libtiff5-dev + libx11-dev + libxml2a-dev + zlib1g-dev + + +In addition, you need the following build tools: + + make + gcc + flex + perl + pkg-config + + + +Running +------- + +The following Debian packages are the known prerequisites for running Netpbm +(and the package created by 'mkdeb' knows this). + + libc6 + libjpeg8 + libpng12-0 + libsvga1 + libtiff5 + libx11-6 + zlib1g + ghostscript + perl + perl-base + bash + +Note that many of these are needed only for a few parts of Netpbm, and it will +be pretty obvious what the problem is when you need the prerequisite package +and don't have it, so if you don't want to install a prerequisite, it would +probably be fine to force install Netpbm, ignoring the prerequisites. + + +CONFLICTS WITH DEBIAN'S NETPBM +------------------------------ + +Debian has several packages of Netpbm, all based on a slightly modified +Sourceforge Netpbm 9.25 from 2002 (don't be confused by Debian's numbering +system, which makes it look like it is Netpbm 10). If you want to install +Sourceforge Netpbm on your system, you will want first to remove any of these +you have installed: + + netpbm + netpbm-dev + libnetpbm9 + libnetpbm10 + +Sourceforge Netpbm should be backward compatible with all of those. Note that +'mkdeb' makes only one package. It contains the programs, the runtime +libraries, and the development files. + +We have not yet worked out what has to be done about the fact that the Debian +packaging system thinks the Debian Netpbm packages are prerequisites for +things. If you install Sourceforge Netpbm via the package created by mkdeb, +you should tell the Netpbm maintainer whatever you learn about that. + diff --git a/buildtools/debian/mkdeb b/buildtools/debian/mkdeb new file mode 100755 index 00000000..9c7b1735 --- /dev/null +++ b/buildtools/debian/mkdeb @@ -0,0 +1,541 @@ +#!/usr/bin/perl +############################################################################### +# mkdeb +############################################################################### +# +# This generates a Debian packge file (.deb) to install Sourceforge +# Netpbm on a Debian system. +# +# This is especially useful because Debian does not have a good Debian +# package (what Debian contains is derived from Sourceforge Netpbm ca. +# 2002). +# +############################################################################### + +use strict; +use warnings; +use English; +use Getopt::Long; + +my $TRUE=1; my $FALSE = 0; + + + +sub parseCommandLine(@) { + + local @ARGV = @_; # GetOptions takes input from @ARGV only + + my %cmdline; + + my $validOptions = GetOptions(\%cmdline, + "buildtools=s", + "arch=s", + "pkgdir=s", + ); + + if (!$validOptions) { + print(STDERR "Invalid option syntax.\n"); + exit(1); + } + if (@ARGV > 0) { + print(STDERR "This program takes no non-option arguments. " . + "You specified ", + scalar(@ARGV), "\n"); + exit(1); + } + + return(\%cmdline); +} + + + +sub writeFile($$$$) { + my ($fileLinesR, $fileName, $executable, $errorR) = @_; + + my $success = open(FILE, ">$fileName"); + if ($success) { + if ($executable eq 'EXECUTABLE') { + chmod(0755, $fileName); + } else { + chmod(0644, $fileName); + } + foreach (@{$fileLinesR}) { print FILE; } + close(FILE); + } else { + $$errorR = "Unable to open the file " . + "'$fileName' for writing. Errno=$ERRNO\n"; + } +} + + + +sub netpbmVersion($) { + my ($pkgdir) = @_; + + my $versionFileName = "$pkgdir/VERSION"; + + my $versionOpened = open(VERSION, "<$versionFileName"); + + my $retval; + my $error; + + if (!$versionOpened) { + $error = "Unable to open '$versionFileName' for reading. " . + "Errno=$ERRNO\n"; + } else { + my $version = ; + chomp($version); + + if ($version =~ m{^Netpbm (\S*)}) { + my ($versionNumber) = ($1); + $retval = $versionNumber; + } else { + die("Can't understand format of '$versionFileName': '$version'"); + } + close(VERSION); + } + + if ($error) { + print("Failed to determine the version of Netpbm from the package, " + . "so that will not be correct in netpbm.config and netpbm.pc. " + . $error . "\n"); + $retval = "???"; + } + return $retval; +} + + + +sub control($$) { + my ($release, $architecture) = @_; + +# The Debian packaging system doesn't provide a way to express Netpbm's actual +# prerequisites. For example, Netpbm needs Version 6.2 or better of Libjpeg, +# but there is no way to state that here. Instead, we state Libjpeg 8. +# This makes the Netpbm package less useful. + + my %control; + + my $debianNativeNetpbm = + 'netpbm, ' . + 'libnetpbm10, ' . + 'libnetpbm10-dev, ' . + 'netpbm-dev, ' . + 'netpbm-nonfree, ' . + 'pbmwbmp, ' . + 'pnmtopng, ' . + 'ucbmpeg'; + + $control{'Package'} = 'netpbm-sf'; + $control{'Version'} = $release; + $control{'Architecture'} = $architecture; + $control{'Maintainer'} = 'Bryan Henderson '; + $control{'Installed-Size'} = '6164'; + $control{'Depends'} = + 'libc6, ' . + 'libjpeg8, ' . + 'libpng12-0, ' . + 'libsvga1, ' . + 'libtiff5, ' . + 'libx11-6, ' . + 'libxml2a, ' . + 'zlib1g, ' . + 'ghostscript, ' . + 'perl, ' . + 'perl-base, ' . + 'bash' + ; + $control{'Recommends'} = ''; + $control{'Recommends'} = ''; + $control{'Conflicts'} = $debianNativeNetpbm; + $control{'Replaces'} = $debianNativeNetpbm; + $control{'Provides'} = + 'netpbm, ' . + 'pbmwbmp, ' . + 'pnmtopng, ' . + 'netpbm-dev, ' . + 'libnetpbm10' + ; + $control{'Section'} = 'graphics'; + $control{'Priority'} = 'optional'; + $control{'Section'} = 'graphics'; + $control{'Description'} = 'Graphics conversion tools between image formats + Netpbm is a toolkit for manipulation of graphic images, including + conversion of images between a variety of different formats. There + are over 300 separate tools in the package including converters for + more than 80 graphics formats. This is the Super Stable version from + the Sourceforge Netpbm project, unmodified.'; + + return \%control; +} + + + +sub writeControlFile($$) { + my ($controlR, $fileName) = @_; + + open(CTL, '>', $fileName) + or die "Can't open '$fileName': $ERRNO"; + + while (my ($key, $value) = each %{$controlR}) { + print CTL ("$key: $value\n"); + } + + close(CTL); +} + + + +sub createScripts($$) { + my ($dpkgDirName, $buildToolsDir) = @_; + + my @scriptList = ('postinst', 'postrm'); + + my @scriptFileList = map("$buildToolsDir/debian/$_", @scriptList); + + system('cp', @scriptFileList, "$dpkgDirName/DEBIAN/") && + die("Failed to copy postinst, etc. to '$dpkgDirName/DEBIAN'."); + + my @createdFileList = map("$dpkgDirName/DEBIAN/$_", @scriptList); + + chmod(0755, @createdFileList); +} + + + +sub createDirOrDie($) { + my ($newDirName) = @_; + + mkdir($newDirName) + or die("Couldn't create directory '$newDirName'. $ERRNO"); + + chmod(0755, $newDirName); +} + + + +sub +processTemplate($$$) { + my ($templateR, $infoR, $outputR) = @_; + + my @output; + + foreach (@{$templateR}) { + if (m{^@}) { + # Comment -- ignore it. + } else { + if (defined($infoR->{VERSION})) { + s/\@VERSION\@/$infoR->{VERSION}/; + } + if (defined($infoR->{BINDIR})) { + s/\@BINDIR@/$infoR->{BINDIR}/; + } + if (defined($infoR->{LIBDIR})) { + s/\@LIBDIR@/$infoR-.{LIBDIR}/; + } + if (defined($infoR->{LINKDIR})) { + s/\@LINKDIR@/$infoR->{LINKDIR}/; + } + if (defined($infoR->{DATADIR})) { + s/\@DATADIR@/$infoR->{DATADIR}/; + } + if (defined($infoR->{INCLUDEDIR})) { + s/\@INCLUDEDIR@/$infoR->{INCLUDEDIR}/; + } + if (defined($infoR->{MANDIR})) { + s/\@MANDIR@/$infoR->{MANDIR}/; + } + push(@output, $_); + } + } + $$outputR = \@output; +} + + + + + +sub makeConfig($$$) { + my ($fileName, $templateSubsR, $netpbmPkgDir) = @_; +#----------------------------------------------------------------------------- +# Install 'netpbm-config' -- a program you run to tell you things about +# how Netpbm is installed. +#----------------------------------------------------------------------------- + my $error; + + my $configTemplateFilename = $netpbmPkgDir . "/config_template"; + + my $templateOpened = open(TEMPLATE, "<$configTemplateFilename"); + if (!$templateOpened) { + $error = "Can't open template file '$configTemplateFilename'.\n"; + } else { + my @template =