Mac OS X toolchain script patches for Leopard and Tiger

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Prism
Posts: 2
Joined: Wed Sep 26, 2007 5:06 am

Mac OS X toolchain script patches for Leopard and Tiger

Post by Prism »

Hello everyone,

Here is a set of patches that will ensure proper compilation of the current version of the toolchain under Mac OS X. It includes all the fixes recently uncovered by strmnNrmn, bulb, the admin at ragnaru.com and probably others, plus a couple of fixes of my own which are needed for successful compilation under Leopard.

You can find the patches here: http://www.mediafire.com/?3s05b0xbimy

To build the toolchain, first setup your environment as described in http://forums.ps2dev.org/viewtopic.php?t=5391 but before running the toolchain.sh script, expand the patches in the psptoolchain directory and run the provided patch-osx-toolchain.sh script:

> svn co svn://svn.ps2dev.org/psp/trunk/psptoolchain
> cd psptoolchain
> tar xvfj /path/to/your/psptoolchain-osx-patches.tar.bz2
> ./patch-osx-toolchain.sh
> ./toolchain.sh

The toolchain should then build without a hitch. Please note that you will need XCode Tools 3.0 under Leopard. Also, make sure you get the latest packages (the tutorial above installs autoconf 2.5 which is too old, you need at least version 2.59). The very last bit of the toolchain requires packages not listed in the tutorial: readline and libusb, make sure you install these as well. Finally, if running Leopard, you will need to build fink from scratch and all the packages from source (in fink) since there are no binaries yet for Leopard.

For the record, here are the Leopard-related fixes:

- The binutils configure script insists on building executables of type "dSYM", which seems to be some kind of executable package. A dSYM is in fact a directory, and some parts of the binutils/binutils and binutils/ld configure scripts will fail as they try to link the .dSYM "file", so I simply axed the checks. Also, most of binutils executables ending in /usr/local/pspdev/bin after the build have the .dSYM extension, so these files have to be renamed as proper extension-less files. There is probably a smart configure parameter that handles this, but I don't know it, and the patch works, for now at least.
- For some reason, the pspsdk fails to find the symbol PSPSDK_TOPDIR when compiling psp-config. I added the definition at the top of the file, with the standard top directory hardcoded (so don't try to change the prefix of the installation, unless you adjust the patch file manually.)

I also added a little goody of my own for people who like me sometimes work on a laptop without internet access; the stock toolchain scripts will fail when the internet cannot be accessed, even if the tarballs are present (wget fails to find the host and the script dies). So basically I added patches to the toolchain scripts so that they will check if the files are downloaded before trying to connect. The patches are applied by calling the following script:

> ./patch-nodownload-toolchain.sh

By the way, this is not OS X-specific, and the nodownload patches should be usable on Linux, cygwin, etc.

A couple of notes before you run the script:
- The patches only need to be applied once (and indeed trying to apply them more than once will fail.)
- Most of these patches are fairly ugly hacks, really, and will eventually break as the toolchain evolves. (For the record, I last tested it on SVN version 2335.)
- The psplinkusb patch tries to locate the GNU readline by looking in the standard fink and macports directories, but if your prefix folder is exotic, it won't find it.
- Insight does not build successfully, but the original build script simply exits at the first line anyway (i.e, insight is not normally built in the toolchain.) Since I have no use for it, I did not track down the problem; it is possible it does not build on the other platforms either, for all I know.

That's all folks! Enjoy!
Last edited by Prism on Thu Nov 15, 2007 6:34 am, edited 1 time in total.
jait
Posts: 2
Joined: Mon Oct 23, 2006 11:41 pm

Post by jait »

Thanks for the work. I haven't installed fink and I think that's causing me some problems with stage 2. (I fixed that problem by now.)

I did end up changing a few lines in your binutils-script patch. I replaced the "/usr/local/pspdev/" entries with $PSPDEV. I wanted to install stuff outside of the /usr directories.

Again, thanks.

Here's a short diff:

Code: Select all

--- 001-binutils-2.16.1.sh      2007-11-14 10:48:47.000000000 -0600
+++ 001-binutils-2.16.1-jait.sh 2007-11-14 10:50:42.000000000 -0600
@@ -24,9 +24,8 @@
  make clean && make -r -j 2 && make install && make clean || { exit 1; }

  ## Strip off the .dSYM extension from executables, if any
- cd /usr/local/pspdev/bin
- files=`ls -1 /usr/local/pspdev/bin/*.dSYM`
- for file in $files ; do
-       basename=${file%%.dSYM}
-    mv $file $basename
+ for file in `ls $PSPDEV/bin/*.dSYM`
+ do
+       BASENAME=`echo $file | cut -f 1 -d '.'`
+       mv $BASENAME.dSYM $BASENAME
  done
Prism
Posts: 2
Joined: Wed Sep 26, 2007 5:06 am

Post by Prism »

jait wrote:I did end up changing a few lines in your binutils-script patch. I replaced the "/usr/local/pspdev/" entries with $PSPDEV. I wanted to install stuff outside of the /usr directories.

Here's a short diff:

<snip>
That's a good patch to my patch :)

Actually, I modified the binutils script patch in the release to include your changes. The link above was updated accordingly.

Thanks for that!
macdonag
Posts: 5
Joined: Sun Dec 31, 2006 6:53 pm

Alternative download?

Post by macdonag »

Would someone be able to provide an alternative way of getting the patch? The mediafire link times out when I try to download.

Thanks.
macdonag
Posts: 5
Joined: Sun Dec 31, 2006 6:53 pm

Post by macdonag »

Actually, the file's accessible now. And it seems to be building. Fingers crossed. Thanks for the patch.
Archaemic
Posts: 38
Joined: Sun Mar 18, 2007 7:23 am

Post by Archaemic »

Augh, I just spent a few hours fixing it myself (most of that was finding WHERE ac_cv_exeext got set)!

Oddly, I only had to patch two lines, one in binutils/configure and ld/configure, and all of the toolchain built fine, except for psplinkusb. Freetype isn't compiling, either, but I think this is the fault of an old version of libtoolize being in OS X. I haven't gotten a chance to test if any of the compiled stuff actually WORKS because the only program I have at hand is PSPComic, and that requires Freetype...

Here is my patch (which could easily be included in a future revision of the toolchain, really. All it does is make it so that it doesn't compile anything to .dSYM ever. It doesn't properly remove the .dSYM tests that get made from the debugging symbols (as that's what a .dSYM is supposed to be), but that's not really a problem so much):

Code: Select all

--- binutils-2.16.1/binutils/configure       2005-03-22 10&#58;31&#58;04.000000000 -0500
+++ binutils-2.16.1/binutils/configure    2008-10-27 15&#58;54&#58;42.000000000 -0400
@@ -1668,7 +1668,7 @@
   if &#123; &#40;eval echo configure&#58;1669&#58; \"$ac_link\"&#41; 1>&5; &#40;eval $ac_link&#41; 2>&5; &#125;; then
     for file in conftest.*; do
       case $file in
-      *.c | *.o | *.obj&#41; ;;
+      *.c | *.o | *.obj | *.dSYM&#41; ;;
       *&#41; ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
       esac
     done
--- binutils-2.16.1/ld/configure     2005-02-21 06&#58;49&#58;47.000000000 -0500
+++ binutils-2.16.1/ld/configure  2008-10-27 16&#58;25&#58;48.000000000 -0400
@@ -1672,7 +1672,7 @@
   if &#123; &#40;eval echo configure&#58;1673&#58; \"$ac_link\"&#41; 1>&5; &#40;eval $ac_link&#41; 2>&5; &#125;; then
     for file in conftest.*; do
       case $file in
-      *.c | *.o | *.obj&#41; ;;
+      *.c | *.o | *.obj | *.dSYM&#41; ;;
       *&#41; ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
       esac
     done
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Sending patches/binutils-2.16.1-PSP.patch
Transmitting file data .
Committed revision 2440.
Thanks for the patch.
colleenex
Posts: 1
Joined: Fri Aug 14, 2009 7:13 pm

Post by colleenex »

Is their a way to run a Mac Os and Windows Os on the same computer?
Like the title says, I have a windows xp and I would like to have a Mac Os and Windows Os on the same computer, is it kinda of the same way as having ubuntu's xandros presto and windows on the same pc. Otherwise is their to do that?
_________________________
external keyword tool ~ keyworddiscovery.com ~ keycompete.com ~ compete.com ~ webmasterworld.com
Last edited by colleenex on Fri Aug 21, 2009 5:29 pm, edited 1 time in total.
User avatar
Wally
Posts: 663
Joined: Mon Sep 26, 2005 11:25 am

Post by Wally »

colleenex wrote:Is their a way to run a Mac Os and Windows Os on the same computer?
Like the title says, I have a windows xp and I would like to have a Mac Os and Windows Os on the same computer, is it kinda of the same way as having ubuntu's xandros presto and windows on the same pc. Otherwise is their to do that?
Buy a Mac and Install Windows.
Phantom8
Posts: 30
Joined: Fri Jun 17, 2005 10:17 am

Post by Phantom8 »

colleenex wrote:Is their a way to run a Mac Os and Windows Os on the same computer?
Like the title says, I have a windows xp and I would like to have a Mac Os and Windows Os on the same computer, is it kinda of the same way as having ubuntu's xandros presto and windows on the same pc. Otherwise is their to do that?
Google hackintosh.
User avatar
Wally
Posts: 663
Joined: Mon Sep 26, 2005 11:25 am

Post by Wally »

Its a spam bot.. Go figure.
Post Reply