URL Handling in Terminals

Most of the time I spend at the my computer i:s in terminal command windows and terminal based applications. Handling URLs from the command line can be a tad bit annoying. Various voices on the internet have suggested the use of a tool called urlview as a less annoying solution for those few times when you may actually want to follow a URL. Unfortunately the tool is not included in the Gentoo portage repository, so I had to install it from source so I thought I would make a few notes should I have to do this again sometime in the future.

The general approach for installing things from source on a GNU Linux machine is:

  1. Obtain the source you wish to compile and extract in a working directory.
  2. Change to the working directory.
  3. Build configuration file by running ./configure
  4. Run make.
  5. Run make install as root.

Here is how the process went in the specific case of installing urlview.

$ mkdir -p projects/cli
$ cd projects/cli
$ git clone https://github.com/sigpipe/urlview.git
remote: Enumerating objects: 99, done.
remote: Total 99 (delta 0), reused 0 (delta 0), pack-reused 99
Unpacking objects: 100% (99/99), done.
$ cd urlview
$ ./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... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... 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 varargs.h... no
...
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
$ make
cd . && /bin/sh /home/chuck/projects/cli/urlview/missing --run automake-1.11 --gnu
Makefile.am: required file './depcomp' not found
Makefile.am:   'automake --add-missing' can install 'depcomp'
make: ** [Makefile:204: Makefile.in] Error 1
$

Seems the make command ended in an error, but provides a helpful hint on how to resolve, suggesting automake –add-mising.

$ automake --add-missing
Makefile.am: installing './depcomp'
$

And now continuing with make

$ make
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /home/chuck/projects/cli/urlview/missing --run autoconf
/bin/sh ./config.status --recheck
running CONFIG_SHELL=/bin/sh /bin/sh ./configure --no-create --no-recursion
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
...
checking for varargs.h... no
configure: creating ./config.status
 /bin/sh ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"urlview\" -DVERSION=\"0.9\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_CURS_SET=1 -DHAVE_NCURSES_H=1 -DHAVE_SNPRINTF=1 -DHAVE_REGEX_H=1 -DHAVE_STDARG_H=1 -I.   -I/usr/include/ncursesw  -g -O2 -DURLVIEW -Dunix -MT urlview.o -MD -MP -MF .deps/urlview.Tpo -c -o urlview.o urlview.c
mv -f .deps/urlview.Tpo .deps/urlview.Po
gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"urlview\" -DVERSION=\"0.9\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_CURS_SET=1 -DHAVE_NCURSES_H=1 -DHAVE_SNPRINTF=1 -DHAVE_REGEX_H=1 -DHAVE_STDARG_H=1 -I.   -I/usr/include/ncursesw  -g -O2 -DURLVIEW -Dunix -MT enter.o -MD -MP -MF .deps/enter.Tpo -c -o enter.o enter.c
mv -f .deps/enter.Tpo .deps/enter.Po
gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"urlview\" -DVERSION=\"0.9\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_CURS_SET=1 -DHAVE_NCURSES_H=1 -DHAVE_SNPRINTF=1 -DHAVE_REGEX_H=1 -DHAVE_STDARG_H=1 -I.   -I/usr/include/ncursesw  -g -O2 -DURLVIEW -Dunix -MT dokey.o -MD -MP -MF .deps/dokey.Tpo -c -o dokey.o dokey.c
mv -f .deps/dokey.Tpo .deps/dokey.Po
gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"urlview\" -DVERSION=\"0.9\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_CURS_SET=1 -DHAVE_NCURSES_H=1 -DHAVE_SNPRINTF=1 -DHAVE_REGEX_H=1 -DHAVE_STDARG_H=1 -I.   -I/usr/include/ncursesw  -g -O2 -DURLVIEW -Dunix -MT quote.o -MD -MP -MF .deps/quote.Tpo -c -o quote.o quote.c
mv -f .deps/quote.Tpo .deps/quote.Po
gcc  -g -O2 -DURLVIEW -Dunix   -o urlview urlview.o enter.o dokey.o quote.o  -lncursesw

$ sudo make install
make[1]: Entering directory '/home/chuck/projects/cli/urlview'
 /bin/mkdir -p '/usr/local/bin'
  /usr/bin/install -c urlview '/usr/local/bin'
/usr/bin/install -c -m 644 urlview.man /usr/local/share/man/man1/urlview.1
make[1]: Leaving directory '/home/chuck/projects/cli/urlview'
$

Now it is just a matter of reading the fine manual and configuring it for use.