Mac improvements
Just modifying build scripts to make it less painful to build and release on Mac See merge request AttorneyOnline/AO2-Client!64
This commit is contained in:
		
							parent
							
								
									15db260639
								
							
						
					
					
						commit
						f2a4ac013d
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -5,6 +5,7 @@
 | 
				
			|||||||
*.so
 | 
					*.so
 | 
				
			||||||
*.pro.autosave
 | 
					*.pro.autosave
 | 
				
			||||||
base_override.h
 | 
					base_override.h
 | 
				
			||||||
 | 
					.DS_Store
 | 
				
			||||||
 | 
					
 | 
				
			||||||
base-full/
 | 
					base-full/
 | 
				
			||||||
bass.lib
 | 
					bass.lib
 | 
				
			||||||
 | 
				
			|||||||
@ -8,18 +8,36 @@ This program has five main dependencies
 | 
				
			|||||||
* Discord Rich Presence (https://github.com/discordapp/discord-rpc/releases)
 | 
					* Discord Rich Presence (https://github.com/discordapp/discord-rpc/releases)
 | 
				
			||||||
* Qt Apng Plugin (https://github.com/Skycoder42/QtApng/releases)
 | 
					* Qt Apng Plugin (https://github.com/Skycoder42/QtApng/releases)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Help
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you're having issues with any of this, ask in the offical Discord: https://discord.gg/wWvQ3pw
 | 
				
			||||||
 | 
					Alternatively, you can ask OmniTroid#4004 on Discord.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### How to build dynamically (the easy way)
 | 
					### How to build dynamically (the easy way)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### General preparation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
What you want to do is first download the latest version of Qt from the first link. (get the prebuilt dynamic version)
 | 
					What you want to do is first download the latest version of Qt from the first link. (get the prebuilt dynamic version)
 | 
				
			||||||
If you're on Ubuntu, go to the scripts/ folder and run configure_ubuntu.sh. This should fetch all the required dependencies automatically.  
 | 
					After going through the OS-specific steps below, compiling in Qt creator should work.
 | 
				
			||||||
If not, go to each one of the links above and find the right dynamic library for your platform:
 | 
					 | 
				
			||||||
* Windows: .dll
 | 
					 | 
				
			||||||
* Linux: .so
 | 
					 | 
				
			||||||
* Mac: .dylib
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
And put them in BOTH lib/ and the repository root (lib/ is required for linking and root is required for runtime)
 | 
					#### Windows
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Launch Qt creator, open the .pro file and try running it. Ask in the Discord if you're having issues: https://discord.gg/wWvQ3pw  
 | 
					If you're on Windows, you need to go find all the dependencies (see above) and put them in the lib/ folder.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### MacOS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you're on MacOS, you can simply go to terminal and run ./scripts/configure_macos.sh
 | 
				
			||||||
 | 
					This will automatically fetch all the required dependencies. Additionally, if you need to create a standalone release, just run ./scripts/release_macos.sh
 | 
				
			||||||
 | 
					This will make the .app bundle in bin/ able to execute as a standalone.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### Ubuntu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you're on Ubuntu, just go to terminal and run ./scripts/configure_ubuntu.sh
 | 
				
			||||||
 | 
					This should fetch all the required dependencies automatically.  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### Other Linux
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					With some tweaks to the ubuntu script, it shouldn't be a big hassle to compile it on a modern linux. Look in the script and see what you may have to modify.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### How to build statically (the hard way)
 | 
					### How to build statically (the hard way)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										42
									
								
								scripts/configure_macos.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										42
									
								
								scripts/configure_macos.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,42 @@
 | 
				
			|||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# This script fetches all build dependencies for MacOS
 | 
				
			||||||
 | 
					# Tested on MacOS 10.14 (Mojave), Qt 5.13 and XCode 10.2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Exit on errors and unset variables
 | 
				
			||||||
 | 
					set -eu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cd ${ROOT_DIR}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					LIB_TARGET="../../lib"
 | 
				
			||||||
 | 
					BASS_LINK="http://uk.un4seen.com/files/bass24-osx.zip"
 | 
				
			||||||
 | 
					BASSOPUS_LINK="http://www.un4seen.com/files/bassopus24-osx.zip"
 | 
				
			||||||
 | 
					DISCORD_RPC_LINK="https://github.com/discordapp/discord-rpc/releases/download/v3.4.0/discord-rpc-osx.zip"
 | 
				
			||||||
 | 
					APNG_LINK="https://github.com/Skycoder42/QtApng/releases/download/1.1.2-2/qtapng_clang_64_5.13.0.tar.xz"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Easier if we don't need to worry about an existing tmp folder tbh smh
 | 
				
			||||||
 | 
					#      v Add a slash here for free tmp folder cleanup in true javascript community style
 | 
				
			||||||
 | 
					rm -rf tmp
 | 
				
			||||||
 | 
					mkdir tmp
 | 
				
			||||||
 | 
					cd tmp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					curl -Ls ${BASS_LINK} -o bass.zip
 | 
				
			||||||
 | 
					unzip -qq bass.zip
 | 
				
			||||||
 | 
					cp libbass.dylib ${LIB_TARGET}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					curl -Ls ${BASSOPUS_LINK} -o bassopus.zip
 | 
				
			||||||
 | 
					unzip -qq bassopus.zip
 | 
				
			||||||
 | 
					cp libbassopus.dylib ${LIB_TARGET}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					curl -Ls ${DISCORD_RPC_LINK} -o discord_rpc.zip
 | 
				
			||||||
 | 
					unzip -qq discord_rpc.zip
 | 
				
			||||||
 | 
					cp discord-rpc/osx-dynamic/lib/libdiscord-rpc.dylib ${LIB_TARGET}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					curl -Ls ${APNG_LINK} -o apng.tar.xz
 | 
				
			||||||
 | 
					tar -xf apng.tar.xz
 | 
				
			||||||
 | 
					cp clang_64/plugins/imageformats/libqapng.dylib ../../lib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cd ..
 | 
				
			||||||
 | 
					rm -rf tmp
 | 
				
			||||||
@ -1,7 +1,13 @@
 | 
				
			|||||||
#!/bin/sh
 | 
					#!/bin/sh
 | 
				
			||||||
set -e
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#assumes a somewhat recent 64-bit ubuntu
 | 
					# Assumes a somewhat recent 64-bit ubuntu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Exit on errors and unset variables
 | 
				
			||||||
 | 
					set -eu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cd ${ROOT_DIR}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#need some openGL stuff
 | 
					#need some openGL stuff
 | 
				
			||||||
sudo apt install libgl1-mesa-dev
 | 
					sudo apt install libgl1-mesa-dev
 | 
				
			||||||
 | 
				
			|||||||
@ -1,17 +0,0 @@
 | 
				
			|||||||
#!/bin/sh
 | 
					 | 
				
			||||||
set -e
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
DST_FOLDER="./bin/Attorney_Online.app/Contents/Frameworks"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
cd ..
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
mkdir $DST_FOLDER
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
cp ./lib/libbass.dylib $DST_FOLDER
 | 
					 | 
				
			||||||
cp ./lib/libbassopus.dylib $DST_FOLDER
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
install_name_tool -id @executable_path/../Frameworks/libbass.dylib $DST_FOLDER/libbass.dylib
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
install_name_tool -id @executable_path/../Frameworks/libbassopus.dylib $DST_FOLDER/libbassopus.dylib
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
install_name_tool -change @loader_path/libbass.dylib @executable_path/../Frameworks/libbass.dylib ./bin/Attorney_Online.app/Contents/MacOS/Attorney_Online
 | 
					 | 
				
			||||||
							
								
								
									
										22
									
								
								scripts/release_macos.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										22
									
								
								scripts/release_macos.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# This script prepares the compiled bundle for shipping as a standalone release
 | 
				
			||||||
 | 
					# Assumes the Qt bin folder is in PATH
 | 
				
			||||||
 | 
					# Should be used on a "Release" build from QT creator
 | 
				
			||||||
 | 
					# Note that this DOES NOT add the base/ folder
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Exit on errors and unset variables
 | 
				
			||||||
 | 
					set -eu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cd ${ROOT_DIR}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# This thing basically does all the work
 | 
				
			||||||
 | 
					macdeployqt ../bin/Attorney_Online.app
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Need to add the dependencies
 | 
				
			||||||
 | 
					cp ../lib/* ../bin/Attorney_Online.app/Contents/Frameworks
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# libbass has a funny path for some reason, just use rpath
 | 
				
			||||||
 | 
					install_name_tool -change @loader_path/libbass.dylib @rpath/libbass.dylib ../bin/Attorney_Online.app/Contents/MacOS/Attorney_Online
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user