Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#40631 closed submission (fixed)

blockout2 @2.4_0

Reported by: jeremy@… Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.2.0
Keywords: Cc:
Port: blockout2

Description

Hello,

I have ported this GPL game: http://www.blockout.net/blockout2/

The source is from the linux version: http://sourceforge.net/projects/blockout/files/blockout/BlockOut%202.4/

Best Regards, Jeremy

Attachments (3)

blockout2.zip (7.0 KB) - added by jeremy@… 11 years ago.
Portfile and patches
Portfile (2.2 KB) - added by jeremy@… 11 years ago.
New Portfile with mesa removed
patch-BlockOut-Makefile.diff (1.0 KB) - added by jeremy@… 11 years ago.
link OpenGL with framework flag

Download all attachments as: .zip

Change History (11)

Changed 11 years ago by jeremy@…

Attachment: blockout2.zip added

Portfile and patches

comment:1 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Thanks. Some initial observations:

  • The portfile uses a mixture of tabs and spaces. Portfiles should use only spaces, as the modeline states.
  • The distfile name doesn't contain the version number, so the dist_subdir should; see wiki:PortfileRecipes#unversioned-distfiles
  • I'm worried about the post-extract phase which replaces the Makefile. Could the Makefile be patched instead?
  • The app.executable line could be simplified by using the ${worksrcpath} variable instead of ${workpath}
  • The declared universal variant doesn't do anything.

comment:2 in reply to:  1 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Owner: changed from macports-tickets@… to ryandesign@…
Port: blockout2 added
Status: newassigned

Replying to ryandesign@…:

On second thought I see it does contain the version number, they've just removed the period ("bl24"); in that case you may want to compute that instead of repeating it throughout the Portfile.

Also, there are a great many patches. Have the issues you're patching been reported to the developers already? We would prefer not to have to maintain these patches in MacPorts forever. However I see this version is from January 2008, so perhaps the project is dead and there won't be any future versions anyway.

comment:3 in reply to:  1 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to ryandesign@…:

  • I'm worried about the post-extract phase which replaces the Makefile. Could the Makefile be patched instead?

Never mind, I see there was no top-level Makefile before.

comment:4 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

I notice that in BlockOut/Makefile you remove -Dlinux from CXXFLAGS but in ImageLib/src/Makefile you leave it in place. Is this significant?

comment:5 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

I committed the port in r111727 with these further changes:

  • Changed license to "GPL-2+".
  • Passed CC and CXX variables at build time to ensure we're UsingTheRightCompiler and -arch flags.
  • Fixed universal variant by patching ImageLib/src/Makefile to pass -s flag when invoking ar.
  • Fixed capitalization of BlockOut in top-level Makefile to avoid build failure on case-sensitive systems (like our buildbots).
  • Changed app.name to "BlockOut II" to match project's preferred name.
  • Changed app.executable to point to the installed binary so that we don't install the same binary twice.
  • Changed "/opt/local" to "@PREFIX@" in BlockOut/Utils.cpp to make it clear it's a placeholder.
  • Changed "/opt/local" to "$(PREFIX)" in Makefiles and added "PREFIX=${prefix}" to build.args and destroot.args.
  • It ended up linking with the MacPorts OpenGL libraries from the mesa port, not the system's OpenGL framework, so I changed the patch and dependencies.
  • libsdl_image doesn't appear to be used so I removed it from the dependencies.

However, it doesn't run properly. It starts up and plays some sounds, but its window contains a scramble of artifacts from my other open windows. Do you see this on your system with the version I committed as well? If so, perhaps the problem relates to mesa OpenGL.

comment:6 Changed 11 years ago by jeremy@…

Hi Ryan,

I was able to reproduce the problem you found: it was because of the mesa OpenGL as you suspected. Turns out the correct way to build against OpenGL is to use the "-Wl,-framework,OpenGL" flag. (It was working on my machine because I didn't have any conflicting OpenGL libs to pick up.)

Once that change is made, the Portfile doesn't need the mesa dependence.

So I'll attach the new Portfile and patch-BlockOut-Makefile.diff to this ticket.

RE: your other comments:

Sorry about the tabs in the Portfile - I was using vim to edit it so I assumed the modeline at the top had instructed vim the expand tabs.

I don't know what to do about the universal variant (this is my first MacPorts port) - I was just copying the example Portfile I think.

Leaving the -Dlinux was an oversight and should be removed (assuming it doesn't break things).

As you say, the developer hasn't updated the app in many years so I don't expect active support. However, I will submit the fixes to the developer - perhaps having his game ported to OSX will revive some interest.

Thanks for all the other fixes to the Portfile - as I said this is my first port.

Cheers, Jeremy

Changed 11 years ago by jeremy@…

Attachment: Portfile added

New Portfile with mesa removed

Changed 11 years ago by jeremy@…

link OpenGL with framework flag

comment:7 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

comment:8 in reply to:  6 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to jeremy@…:

I don't know what to do about the universal variant (this is my first MacPorts port) - I was just copying the example Portfile I think.

I already fixed the universal variant in r111727. The key, for build systems like blockout2's that do not regard CFLAGS etc. at configure time, is to manually get the right -arch flags and supply them to the build system in the right place. In this port, I chose to add the -arch flags to the CC and CXX environment variables, and I got the correct -arch flags using the [get_canonical_archflags] procedure. This procedure returns the correct -arch flags depending on whether the universal variant was selected or not -- but only if a universal variant -- even an empty one -- is defined before it is used. That is why you sometimes see "variant universal {}" in some ports, and indeed why it is present and needed in blockout2 now.

Leaving the -Dlinux was an oversight and should be removed (assuming it doesn't break things).

As far as I can tell the build system doesn't use this variable at all so leaving it or taking it out should have no effect, so it's simpler to not change it.

Note: See TracTickets for help on using tickets.