1
General / Re: Getting SFML working on Ubuntu based Linux
« on: August 24, 2013, 12:53:09 pm »
I wrote two simple scripts that facilitate installing/uninstalling SFML, and I post them here in case someone else finds them useful (as I do.)
Once you installed the libraries needed (as described in http://www.sfml-dev.org/tutorials/2.1/compile-with-cmake.php, you can run this script to install SFML:
The script takes care of instaling everything, including doxygen documentation and also lets you enable search engine (very useful). All you need to do is to change two parameters in the top of the script: zip_dir (where SFML source zipped file was downloaded) and editor (your preferred editor, which will be used to do the necessary changes in doxygen.in and documentation index.) You might also change install_prefix, in case you want to install SFML to a different place than the default.
To uninstall SFML, for example in order to install a newer version, use this script:
Again, you might need to change install_prefix, in case you installed SFML to a different place than the default.
Both scripts should work on any Linux distribution (not necessarily Ubuntu or other Debian-based distros.)
Once you installed the libraries needed (as described in http://www.sfml-dev.org/tutorials/2.1/compile-with-cmake.php, you can run this script to install SFML:
#!/bin/bash
separator=--------------------------------------------------------------------------------
install_prefix=/usr/local
zip_dir=/home/pap/Downloads
editor=emacs
echo Installing SFML \(install prefix: $install_prefix\).
echo $separator
echo \(1\) Unzipping SFML source file.
unzip -q $zip_dir/SFML-*-sources.zip -d $install_prefix/share
echo $separator
cd $install_prefix/share/SFML*
source_dir=$(pwd)
echo \(2\) Switching working directory $source_dir.
echo $separator
echo \(3\) Changing doxygen settings.
echo You need to modify $source_dir/doc/doxyfile.in so that the
echo SEARCHENGINE flag must be YES.
echo
read -p "Press any key to edit doxygen settings." -n1
$editor $source_dir/doc/doxyfile.in
echo $separator
echo \(4\) Running cmake.
echo You need to change flags SFML_BUILD_DOC and SFML_BUILD_EXAMPLES to TRUE.
echo
read -p "Press any key to run cmake." -n1
cmake -i
echo $separator
echo \(5\) Compiling SFML.
echo
read -p "Press any key to start compiling SFML." -n1
make
echo $separator
echo \(6\) Installing SFML.
echo
read -p "Press any key to install SFML." -n1
make install
echo $separator
doc_index=$install_prefix/share/SFML/doc/html/index.htm
echo \(7\) Fixing javascript issue in searchable documentation.
echo You need to add the following lines:
echo \<script type="text/javascript" src="search/search.js"\>\</script\>
echo \<link href="search/search.css" rel="stylesheet" type="text/css"/\>
echo to the header of the main documentation file $doc_index
echo
read -p "Press any key to edit documentation index file." -n1
$editor $doc_index
echo $separator
echo SFML installed.
separator=--------------------------------------------------------------------------------
install_prefix=/usr/local
zip_dir=/home/pap/Downloads
editor=emacs
echo Installing SFML \(install prefix: $install_prefix\).
echo $separator
echo \(1\) Unzipping SFML source file.
unzip -q $zip_dir/SFML-*-sources.zip -d $install_prefix/share
echo $separator
cd $install_prefix/share/SFML*
source_dir=$(pwd)
echo \(2\) Switching working directory $source_dir.
echo $separator
echo \(3\) Changing doxygen settings.
echo You need to modify $source_dir/doc/doxyfile.in so that the
echo SEARCHENGINE flag must be YES.
echo
read -p "Press any key to edit doxygen settings." -n1
$editor $source_dir/doc/doxyfile.in
echo $separator
echo \(4\) Running cmake.
echo You need to change flags SFML_BUILD_DOC and SFML_BUILD_EXAMPLES to TRUE.
echo
read -p "Press any key to run cmake." -n1
cmake -i
echo $separator
echo \(5\) Compiling SFML.
echo
read -p "Press any key to start compiling SFML." -n1
make
echo $separator
echo \(6\) Installing SFML.
echo
read -p "Press any key to install SFML." -n1
make install
echo $separator
doc_index=$install_prefix/share/SFML/doc/html/index.htm
echo \(7\) Fixing javascript issue in searchable documentation.
echo You need to add the following lines:
echo \<script type="text/javascript" src="search/search.js"\>\</script\>
echo \<link href="search/search.css" rel="stylesheet" type="text/css"/\>
echo to the header of the main documentation file $doc_index
echo
read -p "Press any key to edit documentation index file." -n1
$editor $doc_index
echo $separator
echo SFML installed.
The script takes care of instaling everything, including doxygen documentation and also lets you enable search engine (very useful). All you need to do is to change two parameters in the top of the script: zip_dir (where SFML source zipped file was downloaded) and editor (your preferred editor, which will be used to do the necessary changes in doxygen.in and documentation index.) You might also change install_prefix, in case you want to install SFML to a different place than the default.
To uninstall SFML, for example in order to install a newer version, use this script:
#!/bin/sh
separator=--------------------------------------------------------------------------------
install_prefix=/usr/local
echo Uninstalling SFML \(install prefix: $install_prefix\)
echo $separator
echo Removing directory $install_prefix/include/SFML
rm -f -r $install_prefix/include/SFML
echo Removing entries in $install_prefix/lib/
rm -f $install_prefix/lib/libsfml*
echo Removing entries in $install_prefix/lib/pkgconfig/
rm -f $install_prefix/lib/pkgconfig/sfml*
echo Removing directories in $install_prefix/share/
rm -f -r $install_prefix/share/SFML*
echo $separator
echo SFML uninstalled.
separator=--------------------------------------------------------------------------------
install_prefix=/usr/local
echo Uninstalling SFML \(install prefix: $install_prefix\)
echo $separator
echo Removing directory $install_prefix/include/SFML
rm -f -r $install_prefix/include/SFML
echo Removing entries in $install_prefix/lib/
rm -f $install_prefix/lib/libsfml*
echo Removing entries in $install_prefix/lib/pkgconfig/
rm -f $install_prefix/lib/pkgconfig/sfml*
echo Removing directories in $install_prefix/share/
rm -f -r $install_prefix/share/SFML*
echo $separator
echo SFML uninstalled.
Again, you might need to change install_prefix, in case you installed SFML to a different place than the default.
Both scripts should work on any Linux distribution (not necessarily Ubuntu or other Debian-based distros.)