Would a linux config script help with builds?
Posted: Thu Oct 23, 2008 8:33 am
Considering:
https://bb.oolite.space/viewtopic.php?t= ... adb6aea479
It struck me that much of the work needed to make sure of a compatible build environment for different gnu/linux distros would normally go in a configure script - then the install method would become -
1. get the source
2. cd into top directory
3. ./configure
4. make
5. make install
I.e. the standard gnu/linux install method.
The install target for make would put the program files someplace generic, like /usr/share/games, and put a launcher on the desktop.
With regards to configure - it's bad manners to suggest something to developers without providing code. So ... I was thinking something like this:
Code:
#! /bin/bash
#OOlite Configure Script
#Licence GNU GPL 2008
#www.aegidian.org
# run this script ./configure from the top level build directory.
# re: https://bb.oolite.space/viewtopic.php?t=4595
# also need files -
# jsautoconfig32.h
# jsautoconfig64.h
# GNUbuntu.postamble
#check location of top level makefile
LOC=`pwd`
#mke sure the addons directory exists
echo "checking runtime environment"
if [ -d ~/.Oolite ]
then
if [ -d ~/.Oolite/AddOns ]
then
echo "AddOns directory found - good"
else
echo "Creating AddOns directory"
mkdir ~/Oolite/AddOns;
fi
else
echo "Creating AddOns directory"
mkdir ~/.Oolite
mkdir ~/.Oolite/Addons;
fi
echo "checking build environment"
#Check for 64 bit, if not assume 32 bit
ARC=`uname -m`
if [[ $ARC == x86_64 ]]
then
echo "64 bit kernel detected"
cp jsautoconfig64.h cd deps/Cross-platform-deps/SpiderMonkey/js/src jsautoconfig.h
else
echo "32 bit kernel detected"
cp jsautoconfig32.h cd deps/Cross-platform-deps/SpiderMonkey/js/src jsautoconfig.h
fi
# the Makefile.ref entries below really need to be in the makefile
# the steps should be
# ./configure (sets the build environment)
# make (does the below)
# make install (does what make currently does)
echo "configuring spidermonkey javascript deps"
cd $LOC/deps/Cross-platform-deps/SpiderMonkey/js/src/fdlibm
make -f Makefile.ref
cd ..
make -f Makefile.ref
cd Linux_All_DBG.OBJ
mv libjs.so oldlibjs.so
cd $LOC
echo "done"
echo "configuring postamble"
cd $LOC
mv gnubuntu.postamble GNUmakefile.postamble
echo "done"
exit 0
# Still incomplete and a bit clunky
# need to account for non-ubuntu distros
# want a post-install to move the game files to /usr/share/games/ and put an
# icon on the desktop. Possibly make install should do that too.
[/code]
I know - needs work.
I have been deliberately opaque in the script so everything should be clear to a newbie to scripting. If a regex master wants to obfusticate the code in the name of brevity, be my guest ;)
The above should handle the ubuntu install.
Really need this to be less platform dependent, and include tests for the required dependencies too. Also should not really assume that anything not x86_64 is 32 bit. But it's a start.
What say ye?
https://bb.oolite.space/viewtopic.php?t= ... adb6aea479
It struck me that much of the work needed to make sure of a compatible build environment for different gnu/linux distros would normally go in a configure script - then the install method would become -
1. get the source
2. cd into top directory
3. ./configure
4. make
5. make install
I.e. the standard gnu/linux install method.
The install target for make would put the program files someplace generic, like /usr/share/games, and put a launcher on the desktop.
With regards to configure - it's bad manners to suggest something to developers without providing code. So ... I was thinking something like this:
Code:
#! /bin/bash
#OOlite Configure Script
#Licence GNU GPL 2008
#www.aegidian.org
# run this script ./configure from the top level build directory.
# re: https://bb.oolite.space/viewtopic.php?t=4595
# also need files -
# jsautoconfig32.h
# jsautoconfig64.h
# GNUbuntu.postamble
#check location of top level makefile
LOC=`pwd`
#mke sure the addons directory exists
echo "checking runtime environment"
if [ -d ~/.Oolite ]
then
if [ -d ~/.Oolite/AddOns ]
then
echo "AddOns directory found - good"
else
echo "Creating AddOns directory"
mkdir ~/Oolite/AddOns;
fi
else
echo "Creating AddOns directory"
mkdir ~/.Oolite
mkdir ~/.Oolite/Addons;
fi
echo "checking build environment"
#Check for 64 bit, if not assume 32 bit
ARC=`uname -m`
if [[ $ARC == x86_64 ]]
then
echo "64 bit kernel detected"
cp jsautoconfig64.h cd deps/Cross-platform-deps/SpiderMonkey/js/src jsautoconfig.h
else
echo "32 bit kernel detected"
cp jsautoconfig32.h cd deps/Cross-platform-deps/SpiderMonkey/js/src jsautoconfig.h
fi
# the Makefile.ref entries below really need to be in the makefile
# the steps should be
# ./configure (sets the build environment)
# make (does the below)
# make install (does what make currently does)
echo "configuring spidermonkey javascript deps"
cd $LOC/deps/Cross-platform-deps/SpiderMonkey/js/src/fdlibm
make -f Makefile.ref
cd ..
make -f Makefile.ref
cd Linux_All_DBG.OBJ
mv libjs.so oldlibjs.so
cd $LOC
echo "done"
echo "configuring postamble"
cd $LOC
mv gnubuntu.postamble GNUmakefile.postamble
echo "done"
exit 0
# Still incomplete and a bit clunky
# need to account for non-ubuntu distros
# want a post-install to move the game files to /usr/share/games/ and put an
# icon on the desktop. Possibly make install should do that too.
[/code]
I know - needs work.
I have been deliberately opaque in the script so everything should be clear to a newbie to scripting. If a regex master wants to obfusticate the code in the name of brevity, be my guest ;)
The above should handle the ubuntu install.
Really need this to be less platform dependent, and include tests for the required dependencies too. Also should not really assume that anything not x86_64 is 32 bit. But it's a start.
What say ye?