Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS X Packaging (Q2Pro.app) #106

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

OS X Packaging (Q2Pro.app) #106

wants to merge 22 commits into from

Conversation

jdolan
Copy link

@jdolan jdolan commented Jul 9, 2016

This PR fixes some Clang compilation warnings, and gets OpenAL workable on OS X.

Here's the .config I'm compiling with:

VER = Quetoo.org 03ddefa0d
REV = 03ddefa0d

CONFIG_DEFAULT_MODELIST = 640x480 800x600 1024x768 1440x900 1920x1080
CONFIG_DEFAULT_GEOMETRY = 1440x900

CONFIG_HTTP = 1

CONFIG_OPENAL = 1
CONFIG_FIXED_LIBAL = 1
AL_CFLAGS = -framework OpenAL
AL_LIBS = -framework OpenAL

CONFIG_PNG = 1
CONFIG_JPEG = 1

CONFIG_SDL2 = 1

CONFIG_PATH_HOME = ~/.quake2

A few things I've noticed:

  1. LibPNG implementation struggles to load textures that other engines load just fine. It squawks errors in the console, and the loaded textures are garbled. Not sure if this is specific to OS X, or if you see this on other platforms. Screenshot attached.
  2. OpenAL implementation seems .. odd. Sound attenuation is very different from default behavior. Is Q2Pro's OpenAL considered "ready," or is it still experimental?

@@ -355,7 +355,7 @@ void Cmd_Noclip_f(edict_t *ent)
msg = "noclip ON\n";
}

gi.cprintf(ent, PRINT_HIGH, msg);
gi.cprintf(ent, PRINT_HIGH, "%s", msg);
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix compiler warnings about print format attribute.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't fix spurious warnings like this one.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, boss.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sarcasm? I'd recommend splitting the series into "fix clang warnings" and "implement OSX .app packaging".

@jdolan
Copy link
Author

jdolan commented Jul 9, 2016

You know, the garbled textures on the mesh models might be due to it attempting to load the high-res texture for the Generations Arena model onto the stock .md2 mesh. I have pak-generations-models.pak in ~/.quake2/baseq2. It must explicitly find the .png skins due to r_override_textures, but load the low-poly .md2 from pak0.pak.

What's the preferred way to add 3rd party pak files to override stock content?

@joe0x04
Copy link
Contributor

joe0x04 commented Jul 9, 2016

The menus aren't showing up most likely because you're missing the q2pro.menu file baseq2. I've noticed you just don't get any menus when that's missing.

@jdolan jdolan changed the title Minor fixes for OS X compilation OS X Packaging (Q2Pro.app) Jul 10, 2016
rsync -rzhP $(DIST) $(HTTP_TARGET)

clean:
rm -rf $(TARGET)/*
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is based on the packaging I've created for Quake II, Quetoo, GtkRadiant, etc.. It uses dylibbundler to find, copy and fix dynamically linked dependencies.

if prompt(messages.textures, 'y') == 'y':
rsync(config.textures)

print messages.end
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the game data installation script I developed for my AprQ2 fork. Users can run this to optionally install the 3.20 point release, the game demo, CTF, high res textures, Generations Arena models, etc.. It's like Q2Starter for Apple and Linux.

@jdolan
Copy link
Author

jdolan commented Jul 10, 2016

A compiled OS X application bundle from this branch can be found here:

http://quetoo.org/files/Q2Pro.dmg

To keep the file size down, I did not include any game data resources. So to test this, you'll need a "populated" ~/.quake2/baseq2 -- or you can copy pak0.pak and friends into Q2Pro.app/Contents/Resources/baseq2. But here's a shot of the game running on OS X:

quake054

@Raptor007
Copy link

Raptor007 commented Jun 12, 2018

Thanks for the easy app setup. I was able to make mine Snow Leopard compatible with this .config for q2pro:

# Optional dependencies that worked for me in Snow Leopard, probably via MacPorts:
CONFIG_PNG=y
CONFIG_JPEG=y
CONFIG_HTTP=y

# Snow Leopard identifies as i386 when it's really x86_64:
CPU=x86_64

# My preference is keeping gamedirs like baseq2 adjacent to Q2Pro.app:
CONFIG_PATH_DATA=.
CONFIG_PATH_LIB=.
CONFIG_PATH_HOME=.

And of course, one little tweak to Info.plist:

<key>LSMinimumSystemVersion</key>
<string>10.6.8</string>

@sthalik
Copy link
Contributor

sthalik commented Jun 12, 2018

Only with openal you can distinguish sound direction. The other sound mode doesn't support that. All headphones allow a pretty accurate 5.1 emulation. I recommend building with openal (a .dylib inside the app directory is fine) as it doesn't influence 2.0 sound.

Also I see that the pull request doesn't use install_name_tool, you need that for bundling libraries. See example usage: <https://github.com/opentrack/opentrack/blob/unstable/macosx/install-fail-tool>.

@Raptor007
Copy link

Raptor007 commented Jun 12, 2018

@sthalik Good call, I thought there was some problem with OpenAL and Snow Leopard because I was having linking errors... it turns out I had somehow gotten an old 32-bit version in my /Library/Frameworks, but the one in /System/Library/Frameworks works okay (and MacPorts openal-soft works great). So I got rid of the bad framework and added this to my .config:

CONFIG_OPENAL=y
CONFIG_FIXED_LIBAL=y

The apple/Makefile uses dylibbundler to put together the app, which seems to work recursively to make sure the bundled libraries also have their dependencies. It calls install_name_tool many times to change the prefix to @executable_path/lib on the q2pro binaries and bundled dylibs.

I didn't realize this pull request was from 2016; you can probably drop everything except the apple subdirectory, which stands alone well enough to make an app from the latest q2pro.

@sthalik
Copy link
Contributor

sthalik commented Jun 12, 2018

@Raptor007 openal is LGPL 2 so you may even link it statically without caring. But for dylibs I recommend using otool+install_name_tool in the form I linked. See dyld(1) for the details. It's a horrorshow compared to Unix or Windows in general...

@Raptor007
Copy link

@sthalik It looks like dylibbundler is just a fancy wrapper for otool -L and install_name_tool but I can see why you'd rather stick to a simple shell script than a 3rd party tool. This wasn't my pull request, so I don't think I have permission to change it. I was just commenting on my experiences using it.

@jdolan
Copy link
Author

jdolan commented Jun 12, 2018

Hah! I had forgotten that I ever opened this PR.

I still use a similar packaging strategy (Makefile + dylibbundler) for Quetoo and GtkRadiant on macOS, so I'm happy to support this in Q2Pro as well.

I do recommend using dylibbundler over attempting to mangle the header paths yourself, as the tool performs a recursive search of all dependencies, and ensures that they can each find each other. It's also pretty painless to install.

Of course, Apple just announced that they're killing OpenGL support, so.. this is all moot ;)

@sthalik
Copy link
Contributor

sthalik commented Jun 13, 2018

@jdolan

Of course, Apple just announced that they're killing OpenGL support, so.. this is all moot ;)

Not really. Just wait for a GL -> Metal layer like people use for Vulkan already.

Iceman12k pushed a commit to Iceman12k/q2pro that referenced this pull request Feb 8, 2024
Strip quotes from ‘if’ command arguments.
@carlossless carlossless mentioned this pull request Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants