Blob Blame Raw
# Script to prepare a GIAC spkg for Fedora.  This script is only for the
# package maintainer.


# The upstream tarball name is: giac"$SOURCEORIG".tar.gz

# The name of the output file without tar.gz or tar.bz2 extension

echo >&2 "Testing if the output file already exist in one of gz or bz2 format"
if [ -f "$OUTPUTFILEBASENAME".tar.gz -o -f "$OUTPUTFILEBASENAME".tar.bz2 ] ; then
    echo >&2 "there is already a giac archive of this version"
    exit 1

echo >&2 "Build a temporary working dir"
TARGET=$(mkdir -p "giac-src")
cd "$TARGET"

echo >&2 "Downloading upstream source ..."
wget "$SOURCEORIG.tar.gz"

echo >&2 "Untar upstream source ..."
tar -xzf giac"$SOURCEORIG".tar.gz

echo >&2 "Removing javagiac ..."
rm -rf giac-"$VERSION"/src/javagiac*

echo >&2 "Removing french html doc, but keep keywords, and working makefiles.
 NB: the french html doc is huge and not GPL.
 It is freely redistibuable only for non commercial purposes ..."
cd giac-"$VERSION"/doc/fr
rm -rf [^Mkx]*
rm -rf *.pdf *.eps *.pdf *.png *.cxx *.cas *.jpg *.tex *.stamp *html* cas* *.fig fig*

echo >&2 "Repair the build procedure with a minimal ..."
echo -e "EXTRA_DIST = xcasmenu xcasex keywords\n\nlocaldocdir = \$(docdir)/fr \n\n\
dist_localdoc_DATA = xcasmenu xcasex keywords html_mall html_mtt html_vall">

echo >&2 "Copy and adjust a minimal ..."
cp ../local/ ./
sed -ie 's|localdocdir = $(docdir)/local|localdocdir = $(docdir)/fr|'
sed -ie 's|doc/local|subdir = doc/fr|g'
touch html_mall
touch html_mtt
touch html_vall

echo >&2 "Building giac source tarball ..."
cd ../../../
tar -cz giac-"$VERSION" -f "$OUTPUTFILEBASENAME".tar.gz

echo >&2 "Cleaning extracted dir ..."
rm -rf giac-src
rm -f "giac$SOURCEORIG.tar.gz"
rm -rf giac-"$VERSION"

echo >&2 "Finished."