Bug 11839 - Rarian does not build on FreeBSD/Solaris
Summary: Rarian does not build on FreeBSD/Solaris
Alias: None
Product: Rarian
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other FreeBSD
: highest normal
Assignee: Don Scorgie
QA Contact:
Depends on:
Reported: 2007-08-03 20:26 UTC by Joe Marcus Clarke
Modified: 2008-07-30 04:08 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Description Joe Marcus Clarke 2007-08-03 20:26:35 UTC
There are quite a few Linuxisms with Rarian that prevent it from building out of the box on FreeBSD.  The first is in utils/Makefile.am.  The use of the double '[' is not supported by FreeBSD's /bin/sh.  This is trivial.  Simply change all the "[[" and "]]" to '[' and ']' respectively.

Second, the shell scripts rarian-sk-config.in, rarian-sk-extract.in, rarian-sk-rebuild.in, and rarian-sk-update.in all have #!/bin/bash hardcoded into them.  Since these are .in files, it would be better to search for bash in the PATH (in configure), then replace a #!@BASH@ in the various scripts.  What would be even better is not not have the scripts require bash, but this is not nearly as important.

Finally, the getopt invocation in rarian-sk-update.sh relies on GNU's getopt.  The getopt on FreeBSD (and Solaris) is not nearly as complex in the options it supports.  This isn't such a big deal as FreeBSD has a port of GNU's getopt, but it may be a problem on other platforms.
Comment 1 Don Scorgie 2007-08-12 09:08:27 UTC
I've fixed most of this (the [[ and bash issues):

2007-08-12  Don Scorgie  <Don@Scorgie.org>

	* configure.ac:
	* util/rarian-sk-rebuild.in:
	* util/rarian-sk-config.in:
	* util/Makefile.am:
	* util/rarian-sk-update.in:
	Build fixes for FreeBSD

Alas, I know not about getopt.  I'd welcome any patch to do it a different way (or, I could spend several days hacking up a ... no.).  I've spoken to Sun people any none of the issues affect them.  I'll leave the bug open until such time as I've replaced getopt with something more portable.
Comment 2 Joe Marcus Clarke 2007-08-12 12:57:11 UTC
Thanks for fixing the other two issues.  As for getopt, I'm really not sure how this work on Solaris.  Here is the command line:

TEMP=`getopt -u -n$(basename $0) -o "o:r:p:vqnhV" \
    --longoptions="clean-index,omf-dir:,resulting-dir:,help,version" -- "$@"` \
    || print_usage

On FreeBSD, this produces the usage statement:

getopt: illegal option -- n
getopt: illegal option -- r
getopt: illegal option -- a
getopt: illegal option -- r
getopt: illegal option -- i
getopt: illegal option -- a
getopt: illegal option -- n
getopt: illegal option -- s
getopt: illegal option -- k
getopt: illegal option -- p
getopt: illegal option -- d
getopt: illegal option -- a
getopt: illegal option -- t
getopt: illegal option -- e
getopt: illegal option -- o
Usage: rarian-sk-update [OPTIONS]
Update Rarian scrolls archive from scrollkeeper omf files.
Note: This script is a replacement for scrollkeeper-update, but
does not update the scrollkeeper internal database.

-o DIR, --omf-dir=DIR           Use the specified omf directories for
                                conversion. Multiple directories can be 
                                specified using colon (:) separator.
-r DIR, --resulting-dir=DIR     Use the specified directory for the resulting
                                scrolls.  If the directory doesn't exist, it
                                will be created at run time.
                                 Note: Multiple output paths are not supported
--clean-index                   Rebuild the index entirely.  This will rebuild
                                all scroll files and may take a long time.
-v                              Turn Verbosity on.
-p                              Specify a different place to store the mtimes file.
-q                              Run silently (default).
-h, -?, --help                  Print this help message and exit.

Using this script without option will use the default omf directory
'/usr/local/share/omf' and the default output directory '/usr/local/share/help'

On Solaris 10, this produces:

getopt: illegal option -- n
getopt: illegal option -- b
getopt: illegal option -- a
getopt: illegal option -- s
getopt: illegal option -- h
getopt: illegal option -- o

Admittedly, rarian-sk-update doesn't do much anymore given the default configure options.

Maybe a solution to this would be to test the various getopt implementations, and require GNU getopt.  Alternatively, the script could be converted to Perl, and use its getopt capabilities to support the long options.

The easiest option might just be to drop long option support, and use:

TEMP=`getopt "o:r:p:vqnhV" $@` || print_usage
Comment 3 Ghee Teo 2008-01-03 06:59:11 UTC
This is actually a problem in Solaris. We do not have getopt from GNU.
So I think Joe's suggestion to use

TEMP=`getopt "o:r:p:vqnhV" $@` || print_usage

is a possible alternative. Can this be made as part of the configure script?

Annother bug I have found in rarian 0.7 tarball at least

in line 320 of rarian-sk-update.in

if [ $skip_omf_translate = 0 ]


There corresponding 'fi' for the 'if' is missing, that means
script will not run properly.

I bumped up the priority just to get your attention.

Comment 4 Don Scorgie 2008-07-29 11:26:51 UTC
Fixed by removing longopts (replacing --clean-index with -c and removing the other long options).

It shouldn't matter a huge amount as the script by default doesn't do anything.

Finally, the corresponding fi is right at the end of the file (fi # ENABLE_OMF_READ), where it should be.

2008-07-29  Don Scorgie  <Don@Scorgie.org>
	* util/rarian-sk-update.in: 
	Remove longopts to make FreeBSD / Solaris work properly
	bug #11839
Comment 5 Ghee Teo 2008-07-30 04:08:28 UTC
Thanks Don.
You are absolutely right about the fi, totally my fault and I forgot to update this bug when I found out subsequently.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.