Opened 19 years ago

Closed 19 years ago

#4173 closed defect (fixed)

making py-game work in 10.4.2 as of 27/07/05

Reported by: todd.opendarwin@… Owned by: ben@…
Priority: Normal Milestone:
Component: ports Version: 1.0
Keywords: Cc: mww@…
Port:

Description

Okay, this is my checklist for getting py-game to work in 10.4.2. It covers all of bugs I've bumped in to. I'm using darwinports (either a fresh install or a fresh selfupdate) as of July 27, 2005 on Mac OS X 10.4.2 with xcode 2.0 and gcc 4.0.0. I have darwinports installed in /usr/local, and use that prefix throughout this report. Most people probably have it installed in /opt/local. You can skip down to the end for the summary of what is wrong if you don't feel like reading everything here.

  1. I've noticed that the SDL Frameworks have been pulled out of the sdl_* Portfiles, and put in to their

own Portfiles. These new libsdl_*-framework ports haven't been put into the dports tree yet though, so the first thing is to go get them from the attachment list for bug #3469. These new Portfiles work great in my limited experience, but it would be really cool if they were in the ports tree.

  1. Build libsdl-framework, libsdl_mixer-framework, libsdl_ttf-framework and libsdl_image as usual. No

problems here.

  1. Fetch and extract libsdl_image-framework. SDL_Image ships with a bundled copy of libpng 1.0.12,

which is incompatible with the libpng 1.2.8 currently being distributed with darwinports and that is installed by libsdl_image in step 2. Trying to get py-game to load a png file without performing the following fix results in this error at runtime:

libpng warning: Application was compiled with png.h from libpng-1.0.12 libpng warning: Application is running with png.c from libpng-1.2.8 libpng error: Incompatible libpng version in application and library

So we need to point SDL_Image at our local copy of libpng.a and png.h

Assuming that darwinports is installed in /usr/local

cd /usr/local/var/db/dports/sources/rsync.rsync.opendarwin.org_dpupdate_dports/ cd devel/libsdl_image-framework cd work/SDL_image-1.2.4/PBProjects/graphics cd include mv png.h png.h.old ln -s /usr/local/include/png.h png.h cd ../lib/ mv libpng.a libpng.a.old ln -s /usr/local/lib/libpng.a libpng.a

Now we can build libsdl_image-framework and everything is fine.

I'm not sure what the best solution for this one is. libsdl_image just ships with an older version of libpng. I don't think it's feasible to have darwinports include an alternate port for the old version, since they both use the name libpng. Perhaps the libsdl_image-framework can just hack the install as I have shown above, or perhaps there is some better way to do it that I don't know about.

  1. Now we can install the rest of py-game normally (port install py-game)
  1. pygame 1.6.2 has a bug in its init.py file, which causes a crash when you're running some

games built with bundlebuilder. Specifically it throws up this error:

File "/usr/local/lib/python2.4/site-packages/pygame/init.py", line 180, in init

os.chdir(os.path.basedir(sys.argv[0]))

AttributeError: 'module' object has no attribute 'basedir'

So we need to edit /usr/local/lib/python2.4/site-packages/pygame/init.py, line 180 and change:

os.chdir(os.path.basedir(sys.argv[0]))

to

os.chdir(os.path.dirname(sys.argv[0]))

This bug was fixed in the pygame source tree after I reported it to them, so the easy fix here is to probably just update the py-game port to the latest version.

And that's it. I've been through this little ritual twice now, on two different machines, from fresh darwinports installs. I think I've covered everything. I know that this is kind of long and maybe a bit scattered, but I've been fighting with py-game ever since 10.4 arrived, and finally got it working, and thought I should document what I had to do. There are 3 specific things that prevent someone from doing a 'port install py-game' and having it work:

a) libsdl*-framework ports aren't in dports yet, and should probably be listed in the dependencies for py-game, or at the very least added as a variant. b) libsdl_image is bundling a version of libpng that is incompatible with the libpng included in darwinports c) py-game 1.6.2 has a bug that is apparently fixed in the latest version.

Change History (1)

comment:1 Changed 19 years ago by ben@…

Resolution: fixed
Status: newclosed

thanks for the detailed report. i have:

  • put the frameworks into the dports tree (though they're probably not available

until someone runs portindex)

  • fixed libsdl_image-framework to link against the DP libpng and jpeg instead of

its own one (and confirmed this fixes png loading)

  • submitted an update (bug #4184) to py-game so (a) it depends on the

frameworks, and (b) the init.py problem is fixed.

once these changes have filtered through, please test them and let me know how you get on

Note: See TracTickets for help on using tickets.