Saturday, May 10, 2008

Compiling and Installation Problems

Apparently, when I completed the conversion to Gambas2 from Gambas1 I neglected to pay close attention to the compile and installation scripts I provided with the source package. They contain bugs. The next release of GradeL will include the correct scripts, but in the meantime, I have included them here:

compile.sh:
#!/bin/sh

# This shell script compiles and archives GradeL using Gambas2.
# The result is the binary archive gradel, which can be run
# by typing ./gradel from the source directory or installed
# using sudo sh ./install.sh.

echo ""
echo "GradeL Compile Script"
echo "----------------------------------------"
echo "Checking for compiled components..."

if [ -d .gambas ]
then
echo "Removing old files..."
cd .gambas
rm *
cd ..
rmdir .gambas
fi

if [ -f gradel ]
then
rm gradel
fi

echo ""
echo "Compiling GradeL with gbc2 -p -a ..."

# It is important to include the -p and -a flags
gbc2 -p -a

echo "Creating executable archive \"gradel\" with gba2 ..."
gba2

# Rename executable archive
mv gradel-0.9.1.gambas gradel

echo "Done!"
echo ""
echo "To run gradel type: ./gradel"
echo "or"
echo "sudo \"sh ./install.sh\" to install on Ubuntu."
echo ""
install.sh:
#!/bin/sh

# This shell script installs GradeL to the system.
# Be sure to run compile.sh first.
# Gradel can be removed from the system with uninstall.sh.

echo ""
echo "GradeL Install Script"
echo "------------------------------------------------"

# GradeL binary installs in the /usr/bin directory
echo " Copying GradeL program to /usr/bin"
cp gradel /usr/bin

# Gradel icon installs in /usr/share/gradel directory
if [ -d /usr/share/gradel ]
then
echo " Copying GradeL icon to /usr/share/gradel"
cp images/gradel.png /usr/share/gradel
else
mkdir /usr/share/gradel
echo " Copying GradeL icon to /usr/share/gradel"
cp images/gradel.png /usr/share/gradel
fi

# INSTALL, README, ChangeLog and COPYING install in /usr/share/doc/gradel
if [ -d /usr/share/doc/gradel ]
then
echo " Copying INSTALL, README, COPYING, and ChangeLog to /usr/share/doc/gradel"
cp COPYING /usr/share/doc/gradel
cp INSTALL /usr/share/doc/gradel
cp README /usr/share/doc/gradel
cp ChangeLog /usr/share/doc/gradel
else
mkdir /usr/share/doc/gradel
echo " Copying INSTALL, README, COPYING, and ChangeLog to /usr/share/doc/gradel"
cp COPYING /usr/share/doc/gradel
cp INSTALL /usr/share/doc/gradel
cp README /usr/share/doc/gradel
cp ChangeLog /usr/share/doc/gradel
fi

# Done

echo "Done! To run type gradel. Enjoy the program."
echo ""
uninstall.sh:
#!/bin/sh

# This shell script removes GradeL to the system.

echo ""
echo "GradeL Uninstall Script"
echo "------------------------------------------------"

# Remove binary
echo " Removing binary."
if [ -f /usr/bin/gradel ]
then
rm /usr/bin/gradel
fi

# Remove icon
echo " Removing icon."
if [ -s /usr/share/gradel ]
then
rm /usr/share/gradel/*.*
#rm /usr/share/gradel/*
rmdir /usr/share/gradel
fi

# Remove docs
echo " Removing documents."
if [ -s /usr/share/doc/gradel ]
then
#rm /usr/share/doc/gradel/*.*
rm /usr/share/doc/gradel/*
rmdir /usr/share/doc/gradel
fi

# Done
echo " GradeL has been removed from your system."
echo ""
Keep the bug reports and questions coming!

No comments: