Permalink
Browse files

Merge branch 'mingw-changes' of https://github.com/miigotu/ps3toolchain

  • Loading branch information...
2 parents ec49562 + a81d741 commit 7e97f8a27a4cdc4c0e346878e04c4be6762a1e7e Dan Peori committed Mar 11, 2011
Showing with 137 additions and 78 deletions.
  1. +1 −1 depends/check-ncurses.sh
  2. +136 −77 toolchain-mingw.sh
View
@@ -1,4 +1,4 @@
#!/bin/sh
# check-ncurses.sh by Dan Peori (dan.peori@oopo.net)
-( ls /usr/include/ncurses.h || ls /usr/include/ncurses/ncurses.h || ls /opt/local/include/ncurses.h || ls /usr/include/curses.h ) 1> /dev/null 2> /dev/null || { echo "ERROR: Install ncurses before continuing."; exit 1; }
+( ls /usr/include/ncurses.h || ls /usr/include/ncurses/ncurses.h || ls /opt/local/include/ncurses.h || ls /usr/include/curses.h || ls /mingw/include/curses.h) 1> /dev/null 2> /dev/null || { echo "ERROR: Install ncurses before continuing."; exit 1; }
View
@@ -14,65 +14,80 @@ MINGW32EXPORTS=\
'export PSL1GHT=$PS3DEV/psl1ght' \
'export PATH="$PATH:$PSL1GHT/host/bin"')
-if [ $MSYSTEM == MINGW32 ]; then
- DO_SET_EXPORTS=0
- echo -e "\E[1;31mWARNING:\E[0m\E[1m If you continue, his script will modify your global profile!\E[0m"
- echo
- echo The purpose of this change is to add export paths to your profile.
- echo To undo this, edit /etc/profile and removing these lines from the bottom:
- echo -e '(\E[4mNote:\E[0m These are also the exports that will be added, take note.)'
- echo
- echo -e '\E[0;32m export GITINSTALLDIR=/c/msysgit'
- echo ' export PATH="$PATH:$GITINSTALLDIR/bin"'
- echo ' export PATH="$PATH:$GITINSTALLDIR/mingw/bin"'
- echo ' export PYINSTALLDIR=/c/python27'
- echo ' export PATH="$PATH:$PYINSTALLDIR"'
- echo ' export PS3DEV=/usr/local/ps3dev'
- echo ' export PATH="$PATH:$PS3DEV/bin"'
- echo ' export PATH="$PATH:$PS3DEV/host/ppu/bin"'
- echo ' export PATH="$PATH:$PS3DEV/host/spu/bin"'
- echo ' export PSL1GHT=$PS3DEV/psl1ght'
- echo -e ' export PATH="$PATH:$PSL1GHT/host/bin"\E[0m'
- echo
- echo It is highly recommended that you do this, to have the same build that most
- echo others have, so that it is easier for others to help you when you have issues.
- echo Also, the buildscripts will fail if certain paths and variables are not set.
- echo
- echo -e '\E[1mDo you want to set these exports?\E[0m'
- echo
-
- PS3="Enter 1, 2, or 3: "
- options=("Yes, change my profile for me." "No, I have set them myself, but continue." "Quit, I will set them myself.")
- select opt in "${options[@]}"
- do
- case $opt in
- "Yes, change my profile for me.")
- DO_SET_EXPORTS=1
- break
- ;;
- "No, I have set them myself, but continue.")
- break
- ;;
- "Quit, I will set them myself.")
+DO_SET_EXPORTS=1
+HAS_ANSWERED=0
+NEWLINE=0
+RESTART=0
+
+ask_permission()
+{
+ if [ $DO_SET_EXPORTS -ne 0 ]; then
+ if [ $HAS_ANSWERED -ne 1 ]; then
+ echo -e "\E[1;31mWARNING:\E[0m\E[1m If you continue, his script will modify your global profile!\E[0m"
echo
- echo -e "\E[1mExitting, Run this script again when you are ready.\E[0m"
- exit 0
- ;;
- *) echo Invalid option, please try again.
- ;;
- esac
- done
+ echo The purpose of this change is to add export paths to your profile.
+ echo To undo this, edit /etc/profile and removing these lines from the bottom:
+ echo -e '(\E[4mNote:\E[0m These are also the exports that will be added, take note.)'
+ echo
+ echo -e '\E[0;32m export GITINSTALLDIR=/c/msysgit'
+ echo ' export PATH="$PATH:$GITINSTALLDIR/bin"'
+ echo ' export PATH="$PATH:$GITINSTALLDIR/mingw/bin"'
+ echo ' export PYINSTALLDIR=/c/python27'
+ echo ' export PATH="$PATH:$PYINSTALLDIR"'
+ echo ' export PS3DEV=/usr/local/ps3dev'
+ echo ' export PATH="$PATH:$PS3DEV/bin"'
+ echo ' export PATH="$PATH:$PS3DEV/host/ppu/bin"'
+ echo ' export PATH="$PATH:$PS3DEV/host/spu/bin"'
+ echo ' export PSL1GHT=$PS3DEV/psl1ght'
+ echo -e ' export PATH="$PATH:$PSL1GHT/host/bin"\E[0m'
+ echo
+ echo It is highly recommended that you do this, to have the same build that most
+ echo others have, so that it is easier for others to help you when you have issues.
+ echo Also, the buildscripts will fail if certain paths and variables are not set.
+ echo
+ echo -e '\E[1mDo you want to set these exports?\E[0m'
+ echo
+
+ PS3="Enter 1, 2, or 3: "
+ options=("Yes, change my profile for me." "No, I have set them myself, but continue." "Quit, I will set them myself.")
+ select opt in "${options[@]}"
+ do
+ case $opt in
+ "Yes, change my profile for me.")
+ DO_SET_EXPORTS=1
+ HAS_ANSWERED=1
+ break
+ ;;
+ "No, I have set them myself, but continue.")
+ DO_SET_EXPORTS=0
+ HAS_ANSWERED=1
+ break
+ ;;
+ "Quit, I will set them myself.")
+ echo
+ echo -e "\E[1mExitting, Run this script again when you are ready.\E[0m"
+ exit 0
+ ;;
+ *) echo Invalid option, please try again.
+ ;;
+ esac
+ done
+ fi
+ fi
+}
- NEWLINE=0
- RESTART=0
- for((i = 0; i < 11 && DO_SET_EXPORTS == 1; i++)); do
+if [ $MSYSTEM == MINGW32 ]; then
+ for((i = 0; i < ${#MINGW32EXPORTS[*]}; i++)); do
if ! grep -q "${MINGW32EXPORTS[${i}]}" /etc/profile; then
- if [ $NEWLINE -ne 1 ]; then
- echo >> /etc/profile ##In cases where no new line is at EOF.
- NEWLINE=1
+ ask_permission
+ if [ $DO_SET_EXPORTS -ne 0 ]; then
+ if [ $NEWLINE -ne 1 ]; then
+ echo >> /etc/profile ##In cases where no new line is at EOF.
+ NEWLINE=1
+ fi
+ echo ${MINGW32EXPORTS[${i}]} >> /etc/profile
+ RESTART=1
fi
- echo ${MINGW32EXPORTS[${i}]} >> /etc/profile
- RESTART=1
fi
done
if [ $RESTART -eq 1 ]; then
@@ -81,42 +96,86 @@ if [ $MSYSTEM == MINGW32 ]; then
exit 1
fi
+INSTALL_PACKAGES=
+
## Install Dependancy packages
- mingw-get install msys-wget libz libpdcurses gmp pexports msys-patch
+ if [ ! -f /usr//include/gmp.h ]; then
+ INSTALL_PACKAGES+="msys-libgmp-dev gmp gmp-dev "
+ fi
+ if [ ! -f /usr//include/crypt.h ]; then
+ INSTALL_PACKAGES+="msys-libcrypt "
+ fi
+ if [ ! -f /usr/include/zlib.h ]; then
+ INSTALL_PACKAGES+="msys-zlib "
+ fi
+ if [ ! -f /mingw/include/zlib.h ]; then
+ INSTALL_PACKAGES+="libz "
+ fi
+ if [ ! -f /mingw/include/curses.h ]; then
+ INSTALL_PACKAGES+="libpdcurses "
+ fi
+ if [ ! -f /mingw/bin/pexports ]; then
+ INSTALL_PACKAGES+="pexports "
+ fi
+ if [ ! -f /usr/bin/wget ]; then
+ INSTALL_PACKAGES+="msys-wget "
+ fi
+ if [ ! -f /usr/bin/patch ]; then
+ INSTALL_PACKAGES+="msys-patch "
+ fi
+ if [ ! -f /usr/bin/unzip ]; then
+ INSTALL_PACKAGES+="msys-unzip "
+ fi
+ if [ ! -f /usr/include/openssl/sha.h ]; then
+ INSTALL_PACKAGES+="msys-libopenssl "
+ fi
+
+ if [ ${INSTALL_PACKAGES} ]; then
+ mingw-get install $INSTALL_PACKAGES
+ fi
## Create the build directory.
mkdir -p build && cd build || { echo "ERROR: Could not create the build directory."; exit 1; }
## Install libelf
- wget http://www.mr511.de/software/libelf-0.8.13.tar.gz
- tar -zxvf libelf-0.8.13.tar.gz
- cd libelf-0.8.13
- ./configure --prefix="/mingw"
- make
- make install
- cd ..
+ if [ ! -f /mingw/include/libelf.h ]; then
+ wget http://www.mr511.de/software/libelf-0.8.13.tar.gz
+ tar -zxvf libelf-0.8.13.tar.gz
+ cd libelf-0.8.13
+ ./configure --prefix="/mingw"
+ make -j4 && make install
+ cd ..
+ fi
- ## Install pkg-config and dependancy dll's
- wget http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.25-1_win32.zip
- wget http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime_0.18.1.1-2_win32.zip
- wget http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.26/glib_2.26.1-1_win32.zip
- unzip -o pkg-config_0.25-1_win32.zip bin/*.exe -d /mingw > NUL
- unzip -o glib_2.26.1-1_win32.zip bin/*.dll -d /mingw > NUL
- unzip -o gettext-runtime_0.18.1.1-2_win32.zip bin/*.dll -d /mingw > NUL
+ ## Install pkg-config and dependancy dll's
+ if [ ! -f /usr/bin/pkg-config ]; then
+ wget http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.25-1_win32.zip
+ unzip -o pkg-config_0.25-1_win32.zip bin/*.exe -d /usr > NUL
+ fi
+ if [ ! -f /usr/bin/intl.dll ]; then
+ wget http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime_0.18.1.1-2_win32.zip
+ unzip -o gettext-runtime_0.18.1.1-2_win32.zip bin/*.dll -d /usr > NUL
+ fi
+ if [ ! -f /usr/bin/libglib-2.0-0.dll ]; then
+ wget http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.26/glib_2.26.1-1_win32.zip
+ unzip -o glib_2.26.1-1_win32.zip bin/*.dll -d /usr > NUL
+ fi
rm -Rf pkg-config_0.25-1_win32.zip glib_2.26.1-1_win32.zip gettext-runtime_0.18.1.1-2_win32.zip libelf-0.8.13.tar.gz libelf-0.8.13
## Convert python.dll to a shared library
- PYDLL="$WINDIR\SysWOW64\python27.dll"
- pexports "$PYDLL" > python27.def
- if [ $? != 0 ]; then
- PYDLL="$WINDIR\System32\python27.dll"
+ if [ ! -f $PYINSTALLDIR/libs/libpython27.a ]; then
+ PYDLL="$WINDIR\SysWOW64\python27.dll"
pexports "$PYDLL" > python27.def
+ if [ $? != 0 ]; then
+ PYDLL="$WINDIR\System32\python27.dll"
+ pexports "$PYDLL" > python27.def
+ fi
+ dlltool --dllname "$PYDLL" --def python27.def --output-lib libpython27.a
+ mv libpython27.a $PYINSTALLDIR/libs
+ rm -Rf python27.def
fi
- dlltool --dllname "$PYDLL" --def python27.def --output-lib libpython27.a
- mv libpython27.a $PYINSTALLDIR/libs
- rm -Rf python27.def
## Enter the ps3toolchain directory.
cd ..

0 comments on commit 7e97f8a

Please sign in to comment.