Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
macosxrelease [2012/12/23 07:27]
socapex
macosxrelease [2013/04/02 03:00]
socapex [Problems and Improving the Workflow]
Line 1: Line 1:
-====== Releasing ManaPlus for Mac OSX ======+====== ​Compiling and Releasing ManaPlus for Mac OSX ======
  
  
Line 18: Line 18:
 == Updating localization == == Updating localization ==
  
-Unfortunately,​ since ManaPlus has certain problems in compiling through the usual CMake, I wasn't able to setup a nice workflow for the translations (see things to improve). So, you will have to download a nightly build (for example ​the windows one) and overwrite the Xcode > locale folder with the one from the nightly buildThis should ensure ​you have the latest translations.+No need to do anything special here, I have include an automatic script ​to automagically compile ​the localizationsMake sure you have gettext installed through macports.
  
 Now that everything is up to date, you can try to hit Run to test out the build. If it fails, it is probably because you didn't add everything needed, or that a new library has been added (see [[#Working with libraries]]). Now that everything is up to date, you can try to hit Run to test out the build. If it fails, it is probably because you didn't add everything needed, or that a new library has been added (see [[#Working with libraries]]).
  
-Your app is located inside the Derived Data folder Xcode creates. To find it, go to Xcode > Preferences... > Locations and click the little arrow beside the Derived Data path. You can also change the path, and I highly recommend adding to your finder favorites. Navigate to the Build Products ​Debug and there is your debug app.+Your app is located inside the Derived Data folder Xcode creates. To find it, go to Xcode > Preferences... > Locations and click the little arrow beside the Derived Data path. You can also change the path, and I highly recommend adding to your finder favorites. Navigate to the Build/Products/Debugand there is your debug app.
  
 ===== Building a Release ===== ===== Building a Release =====
Line 43: Line 43:
 and the library will be located inside your /​opt/​local/​lib folder. There may be both a dynamic library and a static one (.dylib and .a respectively). If you don't want headaches, **use the static library**. Still, I will explain for both, and the issues of dynamic libraries in case a static version is not available. and the library will be located inside your /​opt/​local/​lib folder. There may be both a dynamic library and a static one (.dylib and .a respectively). If you don't want headaches, **use the static library**. Still, I will explain for both, and the issues of dynamic libraries in case a static version is not available.
  
-If you are using a dynamic library (for whatever crazy reason), read on. If you have a static library and are mentally sane, skip to the static library ​section.+If you are using a dynamic library (for whatever crazy reason), read on. If you have a static library and are mentally sane, skip to the [[#Static Libraries]] ​section.
  
 == Dynamic libraries == == Dynamic libraries ==
Line 97: Line 97:
 </​code>​ </​code>​
  
-I had to add all the necessary dependencies to the project, because they where all pointing to /​opt/​local/​lib,​ which means they were installed through macports, and a user  wont have these libraries available. As a rule of thumb, if the lib is in /usr/lib, then it should be fine, but if it is pointing too /​opt/​local/​lib you will have to include its dependencies. You can do it all manually, or use shell scripts provided in the libs folder (libs-change.sh and libs-id.sh). I found these on the internet but can't recover the source...+I had to add all the necessary dependencies to the project, because they where all pointing to /​opt/​local/​lib,​ which means they were installed through macports, and a user  wont have these libraries available. As a rule of thumb, if the lib or dependency ​is in /usr/lib, then it should be fine. If the library ​is pointing too /​opt/​local/​lib you will have to include its dependencies ​**that are also pointing to /​opt/​local/​lib**. You can do it all manually, or use shell scripts provided in the libs folder (libs-change.sh and libs-id.sh). I found these on the internet but can't recover the source...
  
 So first, add your library .dylib and all its dependencies to a temporary folder, and make sure they don't have more dependencies. Also copy the shell scripts inside this folder. So first, add your library .dylib and all its dependencies to a temporary folder, and make sure they don't have more dependencies. Also copy the shell scripts inside this folder.
Line 108: Line 108:
 To view the result, you can run To view the result, you can run
 <​code>​otool -L *</​code>​ <​code>​otool -L *</​code>​
-inside your folder, you will see all your libraries information. If all is well, add these to the Xcode/lib folder and you should be good to go. You **do not** need to add a script line to Build Phases > Run Scripts for dependencies. Only for the one library ManaPlus now requires (which you did earlier).+inside your folder, you will see all your libraries information. If all is well, add these to the Xcode/lib folder and also drag the dependencies inside your Xcode project in Frameworks/​dependencies. You **do not** need to add a script line to Build Phases > Run Scripts for dependencies. Only for the one library ManaPlus now requires (which you did earlier).
  
 Whew! What a ride. Now you can check out the length of my Static Library section... To see how all of this isn't require when you use a .a library. Whew! What a ride. Now you can check out the length of my Static Library section... To see how all of this isn't require when you use a .a library.
Line 114: Line 114:
 == Static Libraries == == Static Libraries ==
  
-So you are sane and have decided to use Static Libraries. I learned about these after going through the pain of linking all my macports dynamic libraries [sigh]. So lets get started. You have a NewLibrary.a inside your /​opt/​local/​lib directory. Copy that file to the Xcode/lib folder inside the manaplus directory. Take the file and drag it into your Xcode project in the Frameworks section. It should automatically be added to the Summary > Linked Libraries section and also the Build Phases > Link Binary With Libraries area. You need to **remove it** from the Build Phases > Link Binary With Libraries section. This is because Xcode is brocken, and if you leave it there, Xcode will point to a .dylib if it can find one (for more information on this, you can google '​perian-and-xcode-dylib-f.e.t.i.s.h'​ and remove the dots, the wiki doesn'​t like that word).+So you are sane and have decided to use Static Libraries. I learned about these after going through the pain of linking all my macports dynamic libraries [sigh]. So lets get started. You have a NewLibrary.a inside your /​opt/​local/​lib directory. Copy that file to the Xcode/lib folder inside the manaplus directory. Take the file and drag it into your Xcode project in the Frameworks section. It should automatically be added to the Summary > Linked Libraries section and also the Build Phases > Link Binary With Libraries area. You need to **remove it** from the Build Phases > Link Binary With Libraries section. This is because Xcode is broken, and if you leave it there, Xcode will point to a .dylib if it can find one (for more information on this, you can google '​perian-and-xcode-dylib-f.e.t.i.s.h'​ and remove the dots, the wiki doesn'​t like that word).
  
 You will also have to add the full path to the library in the Build Settings > Other Linker Flags section as so: You will also have to add the full path to the library in the Build Settings > Other Linker Flags section as so:
Line 121: Line 121:
 Just add it before or after the existing ones. The $(SRCROOT) will transform to the correct path to your project. Just add it before or after the existing ones. The $(SRCROOT) will transform to the correct path to your project.
  
-Et voila! You are done. The library will get included inside the application bundle, along with everything it needs (I don't think you even need to add dependencies...). Now your glad you didn't use a dynamic library, aren't you.+Et voila! You are done. The library will get included inside the application bundle, along with everything it needs (I don't think you even need to add its dependencies...). Now your glad you didn't use a dynamic library, aren't you.
  
 == Conclusion == == Conclusion ==
Line 127: Line 127:
 Use static libraries. Use static libraries.
  
-Oh, and finally, to make sure all went well, compile the application,​ navigate to its location. Right click and select Show Package Content. Navigate to the executable (Contents ​MacOS ManaPlus). In terminal, type 'otool -L ' with the space, and drag the ManaPlus executable onto the terminal to get its full path. Now press enter, you should not see any library that points to /​opt/​local/​lib,​ and if you used a static library, you shouldn'​t see it either.+Oh, and finally, to make sure all went well, compile the application,​ navigate to its location. Right click and select Show Package Content. Navigate to the executable (Contents/MacOS/ManaPlus). In terminal, type 'otool -L ' with the space, and drag the ManaPlus executable onto the terminal to get its full path. Now press enter, you should not see any library that points to /​opt/​local/​lib,​ and if you used a static library, you shouldn'​t see it either.
  
-====== Problems and Improving the Workflow ======+===== Problems and Improving the Workflow ===== 
 + 
 +If you wish to improve the building experience, here are some good places to start. 
 + 
 +  * Find a way to reference the src directory, instead of hard-linking to the source files. This would let us skip the "​finding and removing files" phase. 
 +<​del> ​ * Create a bash script in the Build Phases to compile the localization files and copy them inside the app bundle. This would allow us to forget about dragging new translations inside the locale folder. It would also ensure everything is always up to date.</​del>​ //done// 
 + 
 +That's pretty much it for now!
Print/export
Languages