To keep up with the latest SFML sources (and to practice my Python skills), I have made a script which downloads and compiles SFML. It is for Linux (and possibly for Mac). Here is the Python source code:
#!/usr/bin/env python
import os
ask = raw_input("This is a script written to compile the latest version of SFML.\nLets face it, bleeding edge technology rocks!\ \n\nDo you want to continue?(y/n) ")
if ask is 'y':
print("\n\nDownloading source...\n\n")
download = os.system("wget -O SFML_src https://github.com/SFML/SFML/tarball/master")
if download == 0:
print("\nExtracting tarball...\n\n")
extract = os.system("tar -zxvf ./SFML_src")
if extract == 0:
rename = raw_input("\n\nPlease rename SFML source file (LaurentGomila-SFML...) to SFML.\nType OK to continue")
if rename is 'OK' or 'ok' or 'Ok':
print("\n\nInstalling dependencies...\n\n")
depinst = os.system("sudo apt-get install cmake libpthread-stubs0-dev libx11-dev \
libxrandr-dev libfreetype6-dev libglew1.6-dev libgl1-mesa-dev libjpeg8-dev libsndfile1-dev\
libopenal-dev")
if depinst == 0:
print("\n\nBuilding SFML...\n\n")
config = os.system("cmake ./SFML")
if config == 0:
print("\n\nCompiling...\n\n")
makeSF = os.system("make")
if makeSF == 0:
print("\n\nInstalling...\n\n")
installSF = os.system("sudo make install")
if installSF == 0:
print("\n\nRunning ldconfig...\n\n")
os.system("sudo ldconfig")
finish = raw_input("\n\nSFML installed successfully. Press enter to finish.")
if finish == '\n':
pass
else:
print("An error occured while making SFML")
else:
print("\n\nAn error occured while compiling SFML source with cmake\n\n")
else:
print("\n\nAn error occured while installing required dependencies.\n\n")
else:
print("\n\nAn error occurred. Check if the source file was renamed\n\n")
else:
print("\n\nAn error occured while extreacting the file\n\n")
else:
print("\n\nAn error occured while downloading.\n\n")
else:
exit()
I'm still learning Python (I use C++ mostly, but Python can do somethings quicker, like this), so this script can probably be improved loads but I wrote it because it's going to be handy in the future.
Note: at one point, it will ask you to rename the extracted file (called LaurentGomila-SFML-[loads of letters and numbers]) to SFML.
Warning: This will overwrite your previous SFML installation.
[attachment deleted by admin]