Install Unpaper from Source

Posted . Visible to the public.

Install Build Tools

sudo yum install autoconf automake gcc gcc-c++ git libtool make yasm pkgconfig zlib-devel

Build Libav From Source

Unpaper rquires Libav Show archive.org snapshot

[kiat@reporting]$ wget https://www.libav.org/releases/libav-12.3.tar.gz
[kiat@reporting]$ tar -xvf libav-12.3.tar.gz
[kiat@reporting]$ cd libav-12.3
[kiat@reporting libav-12.3]$ ./configure
[kiat@reporting libav-12.3]$ make
[kiat@reporting libav-12.3]$ sudo make install

Libav is installed in the following directories:

  • /usr/local/bin
  • /usr/local/include
  • /usr/local/lib
  • /usr/local/share/avconv

Build Unpaper from Source

[kiat@reporting]$ wget https://www.flameeyes.com/files/unpaper-6.1.tar.xz
[kiat@reporting]$ tar -xvf unpaper-6.1.tar.xz
[kiat@reporting]$ cd unpaper-6.1
[kiat@reporting unpaper-6.1]$ ./configure
...
configure: error: Package requirements (libavformat libavcodec libavutil) were not met:

No package 'libavformat' found
No package 'libavcodec' found
No package 'libavutil' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBAV_CFLAGS
and LIBAV_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
...

So we need to set an env var to locate the package config files of Libav:

[kiat@reporting unpaper-6.1]$ export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" 

We try again:

[kiat@reporting unpaper-6.1]$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for gcc option to accept ISO C99... -std=gnu99
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for library containing sqrt... -lm
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for LIBAV... yes
checking for xsltproc... xsltproc
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
[kiat@reporting unpaper-6.1]$ make
  CC       unpaper-file.o
file.c: In function ‘loadImage’:
file.c:68:5: warning: ‘codec’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:712) [-Wdeprecated-declarations]
     if (s->streams[0]->codec->codec_type != AVMEDIA_TYPE_VIDEO)
     ^
file.c:71:5: warning: ‘avcodec_copy_context’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3690) [-Wdeprecated-declarations]
     ret = avcodec_copy_context(avctx, s->streams[0]->codec);
     ^
file.c:71:5: warning: ‘codec’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:712) [-Wdeprecated-declarations]
file.c:96:5: warning: ‘avcodec_decode_video2’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:4200) [-Wdeprecated-declarations]
     ret = avcodec_decode_video2(avctx, frame, &got_frame, &pkt);
     ^
file.c: In function ‘saveImage’:
file.c:196:5: warning: ‘codec’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:712) [-Wdeprecated-declarations]
     codec_ctx = video_st->codec;
     ^
file.c:224:5: warning: ‘avcodec_encode_video2’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:4698) [-Wdeprecated-declarations]
     ret = avcodec_encode_video2(video_st->codec, &pkt, image, &got_packet);
     ^
file.c:224:5: warning: ‘codec’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:712) [-Wdeprecated-declarations]
  CC       unpaper-imageprocess.o
  CC       unpaper-parse.o
  CC       unpaper-tools.o
  CC       unpaper-unpaper.o
  CCLD     unpaper
[kiat@reporting unpaper-6.1]$ sudo make install
make[1]: Entering directory `/home/kiat/unpaper-6.1'
 /usr/bin/mkdir -p '/usr/local/bin'
  /usr/bin/install -c unpaper '/usr/local/bin'
 /usr/bin/mkdir -p '/usr/local/share/doc/unpaper'
 /usr/bin/install -c -m 644 NEWS COPYING README.md AUTHORS '/usr/local/share/doc/unpaper'
 /usr/bin/mkdir -p '/usr/local/share/doc/unpaper'
 /usr/bin/install -c -m 644 doc/basic-concepts.md doc/image-processing.md doc/file-formats.md '/usr/local/share/doc/unpaper'
 /usr/bin/mkdir -p '/usr/local/share/doc/unpaper/img'
 /usr/bin/install -c -m 644 doc/img/blackfilter-detail.png doc/img/blackfilter.png doc/img/blurfilter-detail.png doc/img/blurfilter.png doc/img/border-align.png doc/img/border-scan.png doc/img/deskew-detail1.png doc/img/deskew-detail2.png doc/img/deskew.png doc/img/documentation.odg doc/img/input-pages.png doc/img/layout-templates.png doc/img/mask-center.png doc/img/mask-scan-detail1.png doc/img/mask-scan-detail2.png doc/img/mask-scan.png doc/img/multiple-input-files.png doc/img/multiple-output-files.png doc/img/noisefilter.png doc/img/output-pages.png doc/img/processing-order.png doc/img/sheetspages.png doc/img/standard-deviation.png '/usr/local/share/doc/unpaper/img'
 /usr/bin/mkdir -p '/usr/local/share/man/man1'
 /usr/bin/install -c -m 644 unpaper.1 '/usr/local/share/man/man1'
make[1]: Leaving directory `/home/kiat/unpaper-6.1'

Check version

[kiat@reporting unpaper-6.1]$ unpaper --version
6.1

Installed!

kiatng
Last edit
kiatng
Posted by kiatng to RPA - ML (2019-12-30 05:23)