Re: [hatari-devel] Hatari macOS builds - handover need? |
[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]
If you do a diff with CMakeLists.txt and src/CMakeLists.txt you will see the differences. The FileMerge tool from Xcode is very useful for comparing. The most important differences are in CMakeLists.txt: For building universal binaries targeting macOS 10.13 an later: IF (CMAKE_BUILD_TYPE STREQUAL "Release") set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Target architectures" FORCE) set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Target Min 10.13" FORCE) ENDIF (CMAKE_BUILD_TYPE STREQUAL "Release") and in src/CMakeLists.txt: set_target_properties(Previous PROPERTIES INSTALL_RPATH "@executable_path/../Frameworks") set_target_properties(Previous PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE) With the appended patch I build from the source directory with cmake . make cd src/Previous.app/Contents/MacOS install_name_tool -change /opt/local/lib/libz.1.dylib /usr/lib/libz.1.dylib Previous codesign --force -s - Previous The resulting binary is distributable and contains all non-standard dependencies. The user can start without installing anything on his Mac running macOS 10.13 or later. The file building.previous.txt contains under "Building a distributable application bundle on macOS“ more detailed instructions, also on creating png.framework. You can skip step 3 if using build.diff. |
Attachment:
build.diff
Description: Binary data
Compiling Previous on macOS --------------------------- Previous can be compiled on any UNIX-like operating system including macOS. These instructions also apply to building on Linux except that a different package manager will be used. macOS comes with some packages pre-installed. On other platforms you might need to also install libpcap, readline and zlib. 1. Install macports: Follow the instructions on https://www.macports.org/ to download and install the macports package manager. If not already installed this includes to also install Xcode developer tools. 2. Installing required packages: Download the latest runtime binary of SDL2 from https://www.libsdl.org/ and copy SDL2.framework to /Library/Frameworks. From the command line use the command "port install <package_name>" to install the following packages: cmake libpng 3. Compiling Previous: From the command line change the directory to the location of Previous' source tree and run these commands: mkdir build cd build cmake .. make 4. Installing Previous: Copy Previous.app from build/src to any target directory. It should now be possible to start and use Previous.app. Special notes for Linux ----------------------- 1. It seems that on some distributions of Linux rendering has to be done from the main thread. To make Previous render from the main thread you have to disable the rendering thread with following compile-time option: ./configure --disable-rendering-thread make 2. Some Linux distributions have pre-installed outdated versions of SDL2. You might have to build an up-to-date version yourself. To compile against your own build of SDL2 you have to set an environment variable: setenv SDL2_DIR /path/to/custom/SDL2 ; ./configure make Building a distributable application bundle on macOS ---------------------------------------------------- These are special instructions on how to build an application bundle that can be distributed and run on any macOS version >= deployment target. If you want to build a distributable package skip step 3 from the above instructions and replace with these steps: 1. Build png.framework: a Download source code from http://libpng.org/pub/png/libpng.html b Go to the source directory and build an Xcode project: cmake -G Xcode . -DPNG_FRAMEWORK=ON -DPNG_HARDWARE_OPTIMIZATIONS=OFF c Open the Xcode project and select "libpng" in left side bar d Select "Targets > png_framework" in middle sector e Set "Architectures" to "Standard Architectures (Apple Silicon, Intel)" f Set "Build Active Architecture Only" to "No" g Set "macOS Deployment Target" to "macOS 10.13" or oldest available h Set "Framework Version" to "A" i Set "Compatibility Version" to "1.0.0" j Set "Current Library Version" to the actual version of libpng k Select "png_framework > Any Mac" in title bar and go to "Edit Scheme ..." l Set "Build Configuration" to "Release" m Select "Product > Build" from the menu bar n Using Terminal go to bundle directory, change loader path and sign code: install_name_tool -change /opt/local/lib/libz.1.dylib /usr/lib/libz.1.dylib png codesign --force -s - png o Copy the framework to /Library/Frameworks and make sure no other versions of libpng are installed (if applicable remove macports version of libpng) 2. From the command line go to Previous' source directory and build Previous using this command from the command line: cmake . make 3. Add SDL2.framework and png.framework to the application bundle: The application bundle Previous.app is located in the src directory of the source tree. Go inside the application bundle and go to the Contents folder. Copy SDL2.framework and png.framework into the "Frameworks" folder. 4. Change internal linking of Previous: Using Terminal go to the MacOS directory inside the application bundle and run these commands from the command line: install_name_tool -change /opt/local/lib/libz.1.dylib /usr/lib/libz.1.dylib Previous codesign --force -s - Previous 5. Make a package for distribution: Create a folder named "Previous <version>" and copy Previous.app into it. Copy the following files and folders to the same folder: disks gpl.txt readme.previous.txt networking.howto.txt filesharing.howto.txt netboot.howto.txt Archive the folder using the Compress option from the Finder context menu. Compiling Previous on Windows ----------------------------- Previous can be compiled on Windows using the MinGW64 compiler on the MSYS2 platform. The code won't compile with Visual Studio (MSVC) because it relies on POSIX functions that are not supported by MSVC. 1. Install MSYS2 64-bit: Follow the instructions on https://www.msys2.org/ to download and install the MinGW compiler. 2. Installing required packages: Open the MinGW command prompt from the Start menu (MSYS2 MinGW x64) and install the following packages using the command: "pacman -S <package_name>": mingw-w64-x86_64-SDL2 mingw-w64-x86_64-readline mingw-w64-x86_64-zlib mingw-w64-x86_64-libpng mingw-w64-x86_64-libpcap mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja (optional, but recommended) 3. Compiling Previous: On the MSYS2 MinGW x64 prompt change the directory to the location of Previous' source tree and run these commands: mkdir build cd build cmake .. cmake --build . && strip src/Previous.exe 4. Installing Previous: Copy Previous.exe from build/src to any target directory and copy the files listed below from <MSYS2_installation_dir>/mingw64/bin to the same location as Previous.exe: libcrypto-1_1-x64.dll libgcc_s_seh-1.dll libpcap.dll libpng16-16.dll libreadline8.dll libssl-1_1-x64.dll libstdc++-6.dll libtermcap-0.dll libwinpthread-1.dll SDL2.dll zlib1.dll It should now be possible to start and use Previous.exe.
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |