#!/bin/sh

# Copyright (C) 2000-2019 The Xastir Group

# NOTE:
# "Free Standards Group, FSG, Linux Standard Base, LSB, Free
# Standards Certified, LSB Certified and the Free Standards
# Certified logo are trademarks, service marks and certification
# marks, as appropriate, of Free Standards Group in the United
# States and in other countries."
#
# We are in no way representing that Xastir has been certified by
# the FSG.  To do so costs real money.  We do intend some Xastir
# binaries to install and run properly on LSB-3.0 compliant x86
# Linux systems though...
#

# Compile the optional libraries that Xastir can use under Linux
# Standard Base 3.0, in the proper compile order.
#
# These are the files needed:
#
# curl-7.16.0.tar.gz    <http://curl.haxx.se/>
# db-4.4.20.tar.gz      <http://www.sleepycat.com>
# gdal-1.3.2b2.tar.gz   <http://gdal.org/>
###### GraphicsMagick-1.1.7.tar.bz2 <http://www.graphicsmagick.org/>
# GraphicsMagick-1.1.11.tar.bz2 <http://www.graphicsmagick.org/>
# jasper-1.701.0.zip    <http://www.ece.uvic.ca/~mdadams/jasper/>
# jpegsrc.v6b.tar.gz    <http://www.ijg.org/>
####### lesstif-0.94.4.tar.gz <http://www.lesstif.org/>
# lesstif-0.95.0.tar.gz <http://www.lesstif.org/>
# libpng-1.2.14.tar.gz  <http://www.libpng.org/pub/png/libpng.html>
# libXt.a               <http://gforge.freestandards.org/scm/?group_id=5>
# pcre-6.7.tar.gz       <http://www.pcre.org/>
# zlib-1.2.3.tar.gz     <http://www.zlib.net/>
#
# Run this from the /home/src/lsb/ directory, and have the above
# files present there.  This script needs SUDO access to install
# files as well.
# ALSO:  Create this symlink to get rid of some compiler errors
# below, mostly when libtool is trying to use lsbcc:
#
#   /usr/bin/lsbcc -> /opt/lsb/bin/lsbcc
#


cd /home/src/lsb

tar xzf zlib-1.2.3.tar.gz
(cd zlib-1.2.3; ../LSB-BUILD-ZLIB)
rm -rf zlib-1.2.3

tar xzf jpegsrc.v6b.tar.gz
(cd jpeg-6b; ../LSB-BUILD-JPEG)
rm -rf jpeg-6b

tar xzf db-4.4.20.tar.gz
(cd db-4.4.20; ../LSB-BUILD-DB)
rm -rf db-4.4.20

tar xzf curl-7.16.0.tar.gz
(cd curl-7.16.0; ../LSB-BUILD-CURL)
rm -rf curl-7.16.0

# Shows an error creating a shared library but installs the static
# library we need before it errors out... (libjasper.a)
# If I make a symlink:  "/usr/bin/lsbcc -> /opt/lsb/bin/lsbcc", no
# more error...
#unzip -q jasper-1.701.0.zip
#(cd jasper-1.701.0; ../LSB-BUILD-JASPER)
#rm -rf jasper-1.701.0

tar xzf libpng-1.2.14.tar.gz
(cd libpng-1.2.14; ../LSB-BUILD-PNG)
rm -rf libpng-1.2.14

tar xzf pcre-6.7.tar.gz
(cd pcre-6.7; ../LSB-BUILD-PCRE)
rm -rf pcre-6.7


##
##tar xzf lesstif-0.94.4.tar.gz
##(cd lesstif-0.94.4; ../LSB-BUILD-LESSTIF)
##rm -rf lesstif-0.94.4
##
# Shows an error but installs the static library we need before it
# errors out... (libXm.a)
tar xzf lesstif-0.95.0.tar.gz
(cd lesstif-0.95.0; ../LSB-BUILD-LESSTIF)
rm -rf lesstif-0.95.0


# Shows an error creating a shared library but installs the static
# library we need before it errors out... (not true anymore!!!)
tar xjf GraphicsMagick-1.1.7.tar.bz2
(cd GraphicsMagick-1.1.7; ../LSB-BUILD-GRAPHICSMAGICK)
rm -rf GraphicsMagick-1.1.7

# PROBLEM HERE
##tar xzf gdal-1.3.2b2.tar.gz
##(cd gdal-1.3.2b2; ../LSB-BUILD-GDAL)
##rm -rf gdal-1.3.2b2

# Create the links needed in /opt/lsb/lib.xastir and
# /opt/lsb/lib.include directories


