A few years ago, with Dominus's patient and expert help, I was able to build SVN under macOS, but my Dominus-based method stopped working when macOS began requiring 64-bit applications. I know that Dominus has been maintaining a macOS version of DOSBox, but I wonder if there is a way for other people to compile SVN under macOS?
I'm asking because I've started work on one or two projects where I would like to use a customized SVN build.
Thanks in advance for any help.
EDIT: Corrected spelling.
Last edited by emendelson on 2021-03-03, 16:13. Edited 1 time in total.
Last year, starting basically from scratch, but with support and encouragement from Dominus, I learned how to successfully compile 64-bit DOSBox SVN in macOS.
Not only that, but I worked out how to include custom patches for Munt, Glide (with OpenGlide), Nuked OPL3, and also the extra memory and large hard disks (8GB) for better Windows 9x support, all within a static binary that can be packed in a native macOS application bundle.
I am happy to share the results, I was just thinking I was the only one interested.. 😀
It would be terrific to see how you did this. You're not the only person who wants to build DOSBox under macOS. Thank you in advance!
If there's any possibility that you could post code on GitHub or SourceForge, of course that would be ideal, but I know it may be impractical. Back in 2017 I posted on GitHub a bash script named OneStopDOSBoxOSX that built 32-bit DOSBox from SVN. It's still there, but completely obsolete.
Sure, if you can give me a day or so I will tidy up my notes and share them here. So much to discuss, as I have been at this since April of last year, keeping it mostly to myself because I was learning as I went. I was driven to do this because ECE and Staging (at the time) were not really supporting the Mac, and I have experienced performance issues with DOSBox-X. The other factor is that Boxer has been abandoned by the dev and is kind of only just kept going through Github, full of bugs.
I would be happy to post the code to Github if it is allowed .. it would be just the patched source code which can then be built using my instructions. For static builds I need to manually edit the make files after running configure, but not everyone needs that unless you want to transfer the app package between different Macs. Perhaps I can develop separate instructions for those that prefer everything within the binary vs. using dylibs (either installed at the OS level or stored within the app package).
Glide was particularly difficult because I had to fork and patch my own copy of OpenGlide, but in the last week I got it working in both DOSBox-X and SVN (https://github.com/joncampbell123/dosbox-x/issues/2314). Again, just haven't had time during the week to type up the full guide. The reason I want to stick to SVN is that despite all the great features in X, there seems to be some kind of bug causing a 30-50% performance reduction when compared to SVN, which I have confirmed with Dosbench results.
Also, I developed my own customized app wrapper that is kind of reverse engineered from what I saw GOG doing a few years ago. I am happy to provide that wrapper too, but it would be great if someone with more scripting knowledge could help me develop a self-building script for the whole thing, with the binary placed inside an app package.
I am going to start by providing the instructions to compile an SDL1 based 64-bit binary of SVN. This is the simplest way to get it running for most users. My custom patched version would make the process very long, and I need to spend more time writing it up in a logical and easy to follow set of instructions. What I will probably do in the meantime is just place the fully patched source code on Github, which can then be directly compiled. There will be additional dependencies to install OpenGlide and Munt etc., and so that will all be included under the separate instructions.
So, this is how to build regular 64-bit SVN in macOS (confirmed as working in Mojave 10.14.6, but please let me know how this goes in Catalina and/or Big Sur):
For the last step you can use 4 threads to speed up the compilation:
• The DOSBox binary should successfully build and be located in $HOME/Desktop/build/dosbox-code-0/src
• The resulting binary can then replace the one inside a standard DOSBox 0.74 application bundle (under /Contents/MacOS)
• You can edit /Contents/Info.plist to change the app name, copyright etc.
• Running the application should then generate a separate "DOSBox SVN Preferences" in the $HOME/Library/Preferences folder
Last edited by almeath on 2021-03-08, 04:56. Edited 3 times in total.
• Munt static library should install to usr/lib/libmt32emu.a
• Munt source files should install to 'munt' folder in your home folder
4. Patch the DOSBox SVN code
• Ensure that the 'munt' folder is installed to your home folder as detailed above
• Patch files are located by default in munt/DOSBox-mt32-patch
• The specific name of the patch file may vary by version number (i.e. dosbox-SVN-r4319-mt32-patch)
• The SVN patch will be used - NOT the patch for vanilla DOSBox 0.74x etc.
This is terrific. Thank you. Will let you know how it works on Big Sur when I'm back at my development machine.
Thank you again for those very clear instructions!
I am happy to share these results. 😀
I won't get around to it today, but I will get my patched code onto Github next and also provide a pre-compiled binary for those who have trouble with these instructions. It will include all the stuff I have patched in so far - Glide, Nuked, Munt etc.. and I will also provide my custom wrapper to go with it. I am actively working on getting additional patches included.
One thing to note about my wrapper is that it is entirely self-contained - everything is inside it, even the preferences. It does not depend on anything being pre-installed on the macOS system, other than a default install of the OS. Just don't expect it to ever be "notarized" etc. as it is one of those evil "self-modifying" apps that Apple hates so much. 😉
One detail: In order to make sure that the code I distribute isn't limited to my system, I avoid installing brew or any equivalent, in case I mistakenly build something that requires something installed on my system by brew. (This happened to me years ago.) I'll experiment with installing local copies, as in my old OneStopDOSBox.sh script on GitHub.
By all means, I am happy to accept any suggestions to improve the process. As mentioned, I had little to go on so I basically went with whatever process worked.
For the record, I have copied my binaries and wrappers to two other Macs, with default installs of Mojave and Catalina, and no Homebrew or other packages installed. The wrapper works as intended on those systems.
When I build my binary and wrapper, I have manually edited the make files to ensure a static build with everything within the binary. Dominus provided valuable advice in this area. The only thing is that it’s a fiddly manual process to do this .. I don’t have the scripting knowledge to automate it.
Manually editing the make files - that was amazingly fiddly, but Dominus showed me how to automate it. You might want to look at the old OneStopDOSBox OSX script that I created using Dominus's methods. The patch file starts getting created around line 697:
In the meantime, I think the best approach will be to upload the patched source, with instructions that will produce a standard binary with some external dependencies. These would be the same dependencies required to build it in the first place.
While also providing the transportable pre-built app, I will write up some special instructions for those interested in making their own static build.
I am open to some kind of collaboration on this if there is interest.. I would be happy to include an automated script to achieve the above, perhaps even supporting an automatic app package and DMG creation?
I did the same for PCem v17 .. I figured out how to patch and compile it for Big Sur compatibility, and then enlisted the help of some other devs to develop a DMG package.
Just a quick update on Big Sur. I found out that Subversion was removed from macOS 11 command line tools, so it needs to be installed as an additional build dependency in order for the SVN checkout command to be recognized. I have updated my original post with this step.
Definitely interested in collaboration. When you've posted your instructions, I could get started on updating my OneStopDOSBoxOSX script so that it builds your version. I don't pretend to understand what happens my own script, because I'm basically a beginner who mostly uses code that other people wrote, but at least that old script worked correctly, and it should be possible to create a new one.
It is currently patched to include Munt, Glide, Nuked, 384 memory limit, 8GB hd image support.
I have posted the build instructions - not too pretty right now, but it is hard to format things well with Github. I am not saying these are optimal - there may be redundant steps and it could probably be streamlined.
Can you let me know if this works for you?
I have not yet had time to:
- post a fully built binary and wrapper
- provide instructions on how to make a "static" build (i.e. no external dylib dependencies)
- provide instructions on how to build and use OpenGlide and Munt
I will hopefully get those done in the coming days.
@almeath, Thank you for this. I'll test in the next day or two, but would be very interested in how to make a static build. That's the part that I would want to use in my projects, but what you've posted should be useful to many of us!
EDIT: I've been trying to update my old build script, but I can't build libtool or anything else because I get the error "configure: error: C compiler cannot create executables". This seems to be fairly standard under Catalina and Big Sur, and no one has a solution that works, as far as I can see. I'll try doing this under Mojave, and will then come back to Big Sur.
Do this immediately after step C.4 (i.e. before running the "make" command).
1. Patch the primary Makefile
• The Makefile is located in $HOME/Desktop/build/dosbox-code-0/
• Open it in Xcode and check Line 241 (starts with LIBS =), which should appear as follows (yourusername will be substituted with your own macOS username, i.e. name of your Home folder):
• Check the path to each dependency to make sure it exactly matches what is in your user/local folder
• You will notice that the macOS standard libraries remain as they are, but the additional dependencies (i.e. -lpng onwards) need to be removed or modified
• This presumes you installed dependencies to their default locations with homebrew (otherwise edit accordingly!)
• The version numbers above may vary depending on when you installed the dependencies
• Check that Line 257 (starts with SDL_LIBS =) reads as follows:
• As above, "yourusername" should already be showing your own username.
• If the line reads as above, no further changes are needed here.
2. Patch the SRC Makefile
• The SRC Make file is located in $HOME/Desktop/build/dosbox-code-0/src
• Open it in Xcode, and as above, check that Line 246 (starts with LIBS =) appears as follows (again, you will see your username in the SDL paths)
• These edits are identical to the primary make file, except that if you build DOSBox with the Munt patch, you will see that we add an extra path for "libmt32emu.a" to ensure the Munt static library will be incorporated into the binary
• Check that Line 262 (starts with SDL_LIBS =) reads as follows (again, your username should already be substituted here):
2. When complete, immediately run the binary and then while it is running, go to the Activity Monitor app in macOS.
3. Find "dosbox" and then double-click it. A window should pop up that provides three tabs. The last tab should be called "Open Files and Ports".
4. In that section you should see a text field below. Still in Activity Monitor, go to the Edit menu and select "Find" then "Find..."
5. Search for dylib
If your static binary build was successful, you should only see one dylib reference highlighted, which is "/usr/lib/libobjc-trampolines.dylib". This is a standard macOS library.
If any other dylibs show up (i.e. libx11, libxcb, libxau etc.) then you need to go back and carefully check that you followed the above instructions to the letter.
The resulting static binary of DOSBox should run on any macOS standard installation of Mojave, Catalina or Big Sur, without the need for that system to have any of the aforementioned dependencies installed.