Created
December 3, 2011 16:19
-
-
Save chiva/1427486 to your computer and use it in GitHub Desktop.
Platex build scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
asterisks () | |
{ | |
echo "*********************************************" | |
} | |
header () | |
{ | |
echo | |
asterisks | |
echo "$1" | |
asterisks | |
echo | |
} | |
remove() | |
{ | |
if [ -d $1 ]; then | |
rm -rf $1 | |
fi | |
} | |
create() | |
{ | |
if [ ! -d $1 ]; then | |
mkdir -p $1 | |
fi | |
} | |
remove_and_create() | |
{ | |
remove $1 | |
create $1 | |
} | |
copy() | |
{ | |
echo "COPYING [$1] TO [$2]" | |
cp $1 $2 | |
} | |
PYQWT=5.2.0 | |
ARDUINO=1.0.1 | |
PROJECT=Platex | |
CXFREEZE=4.2.3 | |
# Comprobar si tenemos permisos | |
if [ "$(id -u)" != "0" ]; then | |
echo "Uso: sudo $0" | |
exit 6 | |
fi | |
####### | |
header \ | |
"DO NOT RUN THIS SCRIPT ON A PRODUCTION COMPUTER | |
IT MAY END UP BREAKING THINGS | |
Press Ctrl+C to exit" | |
for i in {15..1}; do echo -ne "$i.." && sleep 1; done; echo | |
####### | |
####### | |
header "Creating build folder" | |
####### | |
remove_and_create build | |
cd build | |
####### | |
header "Installing libraries available in repositories" | |
####### | |
apt-get update | |
apt-get -y install git python-qt4 pyqt4-dev-tools python-pip qt4-qmake g++ libqt4-dev python-sip-dev python-qt4-dev alien rpm | |
pip install pyserial --upgrade | |
####### | |
header "Installing cx_Freeze $CXFREEZE" | |
####### | |
wget --trust-server-name http://prdownloads.sourceforge.net/cx-freeze/cx_Freeze-$CXFREEZE.tar.gz || exit 1 | |
tar -zxvf cx_Freeze-$CXFREEZE.tar.gz | |
pushd cx_Freeze-$CXFREEZE | |
python setup.py install | |
popd | |
####### | |
header "Installing PyQwt $PYQWT" | |
####### | |
wget --trust-server-name http://prdownloads.sourceforge.net/pyqwt/PyQwt-$PYQWT.tar.gz || exit 1 | |
tar -zxvf PyQwt-$PYQWT.tar.gz | |
pushd PyQwt-$PYQWT/configure | |
python configure.py -Q ../qwt-5.2 --qt4 --disable-numarray --disable-numeric --disable-numpy | |
make | |
make install | |
popd | |
####### | |
header "Downloading Arduino IDE $ARDUINO" | |
####### | |
wget http://arduino.googlecode.com/files/arduino-$ARDUINO-linux.tgz || exit 1 | |
tar -zxvf arduino-$ARDUINO-linux.tgz | |
####### | |
header "Downloading and compiling $PROJECT source code" | |
####### | |
git clone https://github.com/chiva/$PROJECT.git | |
pushd $PROJECT | |
python mkpyqt.py -b -r | |
mkdir avrdude | |
pushd avrdude | |
cp ../../arduino-$ARDUINO/hardware/tools/avrdude . | |
cp ../../arduino-$ARDUINO/hardware/tools/avrdude.conf . | |
popd | |
pushd firmware | |
pushd ${PROJECT}Firmata | |
make -f Makefile-linux | |
mv applet/${PROJECT}Firmata.hex ../../avrdude/ | |
popd | |
popd | |
popd | |
####### | |
header "Creating distribution files" | |
####### | |
pushd $PROJECT | |
python setup.py bdist_rpm | |
pushd dist | |
alien -d $PROJECT-*.i386.rpm | |
popd | |
popd | |
####### | |
header "Cleaning workspace" | |
####### | |
mv $PROJECT/dist ../$PROJECT-dist | |
cd .. | |
remove build | |
rm "$0" | |
####### | |
header "Done!" | |
####### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
asterisks () | |
{ | |
echo "*********************************************" | |
} | |
header () | |
{ | |
echo | |
asterisks | |
echo "$1" | |
asterisks | |
echo | |
} | |
remove() | |
{ | |
if [ -d $1 ]; then | |
rm -rfv $1 | |
fi | |
} | |
create() | |
{ | |
if [ ! -d $1 ]; then | |
mkdir -p $1 | |
fi | |
} | |
remove_and_create() | |
{ | |
remove $1 | |
create $1 | |
} | |
copy() | |
{ | |
echo "COPYING [$1] TO [$2]" | |
cp $1 $2 | |
} | |
PROJECT=Platex | |
GCC=10.7-v2 | |
GIT=1.7.11 | |
PYTHON=2.7.2 | |
QT=4.7.4 | |
SIP=4.13.3 | |
PYQT=4.9.2 | |
PYQWT=5.2.0 | |
ARDUINO=1.0.1 | |
CXFREEZE=4.2.3 | |
####### | |
header \ | |
"DO NOT RUN THIS SCRIPT ON A PRODUCTION COMPUTER | |
IT MAY END UP BREAKING THINGS | |
RUN WITH SUDO | |
Press Ctrl+C to exit" | |
for i in {15..1}; do echo -ne "$i.." && sleep 1; done; echo | |
####### | |
####### | |
header "Creating build folder" | |
####### | |
remove_and_create build | |
cd build | |
####### | |
header "Installing GCC $GCC" | |
####### | |
curl -fLO --retry 20 https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-$GCC.pkg || exit 1 | |
installer -pkg GCC-$GCC.pkg -target "/" | |
####### | |
header "Installing Git $GIT" | |
####### | |
curl -fO --retry 20 http://git-osx-installer.googlecode.com/files/git-$GIT-intel-universal-snow-leopard.dmg || exit 1 | |
hdiutil attach git-$GIT-intel-universal-snow-leopard.dmg | |
installer -pkg /Volumes/Git\ $GIT\ Snow\ Leopard\ Intel\ Universal/git-$GIT-intel-universal-snow-leopard.pkg -target "/" | |
hdiutil detach /Volumes/Git\ $GIT\ Snow\ Leopard\ Intel\ Universal | |
####### | |
header "Installing Python $PYTHON" | |
####### | |
curl -fO --retry 20 http://python.org/ftp/python/$PYTHON/python-$PYTHON-macosx10.6.dmg || exit 1 | |
hdiutil attach python-$PYTHON-macosx10.6.dmg | |
installer -pkg /Volumes/Python\ $PYTHON/Python.mpkg -target "/" | |
hdiutil detach /Volumes/Python\ $PYTHON/ | |
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}" | |
export PATH | |
####### | |
header "Installing Qt $QT" | |
####### | |
curl -fO --retry 20 http://get.qt.nokia.com/qt/source/qt-mac-opensource-$QT.dmg || exit 1 | |
hdiutil attach qt-mac-opensource-$QT.dmg | |
installer -pkg /Volumes/Qt\ $QT/Qt.mpkg -target "/" | |
hdiutil detach /Volumes/Qt\ $QT | |
####### | |
header "Installing SIP $SIP" | |
####### | |
curl -fO --retry 20 http://www.riverbankcomputing.co.uk/static/Downloads/sip4/sip-$SIP.tar.gz || exit 1 | |
tar -zxvf sip-$SIP.tar.gz | |
pushd sip-$SIP | |
python configure.py | |
make | |
make install | |
popd | |
####### | |
header "Installing PyQt $PYQT" | |
####### | |
curl -fO --retry 20 http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-mac-gpl-$PYQT.tar.gz || exit 1 | |
tar -zxvf PyQt-mac-gpl-$PYQT.tar.gz | |
pushd PyQt-mac-gpl-$PYQT | |
echo "yes" | python configure.py | |
make | |
make install | |
popd | |
####### | |
header "Installing PyQwt $PYQWT" | |
####### | |
MIN_PYQWT=`echo "$PYQWT" | cut -d. -f 1-2` | |
curl -fLO --retry 20 http://prdownloads.sourceforge.net/pyqwt/PyQwt-$PYQWT.tar.gz || exit 1 | |
ln /usr/bin/qmake /bin/qmake | |
tar -zxvf PyQwt-$PYQWT.tar.gz | |
pushd PyQwt-$PYQWT/configure | |
python configure.py -Q ../qwt-$MIN_PYQWT --qt4 --disable-numarray --disable-numeric --disable-numpy | |
make | |
make install | |
popd | |
####### | |
header "Installing pySerial" | |
####### | |
easy_install pip | |
pip install pyserial | |
####### | |
header "Installing cx_Freeze $CXFREEZE" | |
####### | |
curl -fLO --retry 20 http://prdownloads.sourceforge.net/cx-freeze/cx_Freeze-$CXFREEZE.tar.gz || exit 1 | |
tar -zxvf cx_Freeze-$CXFREEZE.tar.gz | |
pushd cx_Freeze-$CXFREEZE | |
python setup.py install | |
popd | |
####### | |
header "Downloading Arduino IDE $ARDUINO" | |
####### | |
curl -fO --retry 20 http://arduino.googlecode.com/files/arduino-$ARDUINO-macosx.zip || exit 1 | |
unzip arduino-$ARDUINO-macosx.zip | |
####### | |
header "Downloading and compiling $PROJECT source code" | |
####### | |
git clone https://github.com/chiva/$PROJECT.git | |
pushd $PROJECT | |
python mkpyqt.py -b -r | |
mkdir avrdude | |
pushd avrdude | |
cp ../../Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude . | |
cp ../../Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf . | |
popd | |
pushd firmware | |
pushd ${PROJECT}Firmata | |
make -f Makefile-mac | |
mv applet/${PROJECT}Firmata.hex ../../avrdude/ | |
popd | |
popd | |
popd | |
####### | |
header "Creating distribution files" | |
####### | |
pushd $PROJECT | |
python setup.py bdist_dmg | |
popd | |
####### | |
header "Cleaning workspace" | |
####### | |
mv $PROJECT/dist ../$PROJECT-dist | |
cd .. | |
remove build | |
rm "$0" | |
####### | |
header "Done!" | |
####### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment