docs/README-macosx.md
changeset 10361 de0c0d037e71
parent 10184 cb09212d4480
child 10556 007dfe83abf8
equal deleted inserted replaced
10360:2e78b92aa9b3 10361:de0c0d037e71
     9 command line tools or Apple's IDE Xcode.
     9 command line tools or Apple's IDE Xcode.
    10 
    10 
    11 To build SDL using the command line, use the standard configure and make
    11 To build SDL using the command line, use the standard configure and make
    12 process:
    12 process:
    13 
    13 
    14 	./configure
    14     ./configure
    15 	make
    15     make
    16 	sudo make install
    16     sudo make install
    17 
    17 
    18 You can also build SDL as a Universal library (a single binary for both
    18 You can also build SDL as a Universal library (a single binary for both
    19 32-bit and 64-bit Intel architectures), on Mac OS X 10.7 and newer, by using
    19 32-bit and 64-bit Intel architectures), on Mac OS X 10.7 and newer, by using
    20 the gcc-fat.sh script in build-scripts:
    20 the gcc-fat.sh script in build-scripts:
    21 
    21 
    22     mkdir mybuild
    22     mkdir mybuild
    23     cd mybuild
    23     cd mybuild
    24     CC=$PWD/../build-scripts/gcc-fat.sh CXX=$PWD/../build-scripts/g++fat.sh ../configure
    24     CC=$PWD/../build-scripts/gcc-fat.sh CXX=$PWD/../build-scripts/g++fat.sh ../configure
    25 	make
    25     make
    26 	sudo make install
    26     sudo make install
    27 
    27 
    28 This script builds SDL with 10.5 ABI compatibility on i386 and 10.6
    28 This script builds SDL with 10.5 ABI compatibility on i386 and 10.6
    29 ABI compatibility on x86_64 architectures.  For best compatibility you
    29 ABI compatibility on x86_64 architectures.  For best compatibility you
    30 should compile your application the same way.
    30 should compile your application the same way.
    31 
    31 
    84 "MyCoolGame.app".
    84 "MyCoolGame.app".
    85 
    85 
    86 To get this build automatically, add something like the following rule to
    86 To get this build automatically, add something like the following rule to
    87 your Makefile.am:
    87 your Makefile.am:
    88 
    88 
    89 bundle_contents = APP_NAME.app/Contents
    89     bundle_contents = APP_NAME.app/Contents
    90 APP_NAME_bundle: EXE_NAME
    90     APP_NAME_bundle: EXE_NAME
    91 	mkdir -p $(bundle_contents)/MacOS
    91     	mkdir -p $(bundle_contents)/MacOS
    92 	mkdir -p $(bundle_contents)/Resources
    92     	mkdir -p $(bundle_contents)/Resources
    93 	echo "APPL????" > $(bundle_contents)/PkgInfo
    93     	echo "APPL????" > $(bundle_contents)/PkgInfo
    94 	$(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
    94     	$(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
    95 
    95 
    96 You should replace EXE_NAME with the name of the executable. APP_NAME is what
    96 You should replace EXE_NAME with the name of the executable. APP_NAME is what
    97 will be visible to the user in the Finder. Usually it will be the same
    97 will be visible to the user in the Finder. Usually it will be the same
    98 as EXE_NAME but capitalized. E.g. if EXE_NAME is "testgame" then APP_NAME 
    98 as EXE_NAME but capitalized. E.g. if EXE_NAME is "testgame" then APP_NAME 
    99 usually is "TestGame". You might also want to use `@PACKAGE@` to use the package
    99 usually is "TestGame". You might also want to use `@PACKAGE@` to use the package
   103 more. For each of your target applications, you need a separate rule.
   103 more. For each of your target applications, you need a separate rule.
   104 
   104 
   105 If you want the created bundles to be installed, you may want to add this
   105 If you want the created bundles to be installed, you may want to add this
   106 rule to your Makefile.am:
   106 rule to your Makefile.am:
   107 
   107 
   108 install-exec-hook: APP_NAME_bundle
   108     install-exec-hook: APP_NAME_bundle
   109 	rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
   109     	rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
   110 	mkdir -p $(DESTDIR)$(prefix)/Applications/
   110     	mkdir -p $(DESTDIR)$(prefix)/Applications/
   111 	cp -r $< /$(DESTDIR)$(prefix)Applications/
   111     	cp -r $< /$(DESTDIR)$(prefix)Applications/
   112 
   112 
   113 This rule takes the Bundle created by the rule from step 3 and installs them
   113 This rule takes the Bundle created by the rule from step 3 and installs them
   114 into $(DESTDIR)$(prefix)/Applications/.
   114 into "$(DESTDIR)$(prefix)/Applications/".
   115 
   115 
   116 Again, if you want to install multiple applications, you will have to augment
   116 Again, if you want to install multiple applications, you will have to augment
   117 the make rule accordingly.
   117 the make rule accordingly.
   118 
   118 
   119 
   119 
   124 1) The bundle right now probably is dynamically linked against SDL. That 
   124 1) The bundle right now probably is dynamically linked against SDL. That 
   125    means that when you copy it to another computer, *it will not run*,
   125    means that when you copy it to another computer, *it will not run*,
   126    unless you also install SDL on that other computer. A good solution
   126    unless you also install SDL on that other computer. A good solution
   127    for this dilemma is to static link against SDL. On OS X, you can
   127    for this dilemma is to static link against SDL. On OS X, you can
   128    achieve that by linking against the libraries listed by
   128    achieve that by linking against the libraries listed by
   129      sdl-config --static-libs
   129 
       
   130        sdl-config --static-libs
       
   131 
   130    instead of those listed by
   132    instead of those listed by
   131      sdl-config --libs
   133 
       
   134        sdl-config --libs
       
   135 
   132    Depending on how exactly SDL is integrated into your build systems, the
   136    Depending on how exactly SDL is integrated into your build systems, the
   133    way to achieve that varies, so I won't describe it here in detail
   137    way to achieve that varies, so I won't describe it here in detail
       
   138 
   134 2) Add an 'Info.plist' to your application. That is a special XML file which
   139 2) Add an 'Info.plist' to your application. That is a special XML file which
   135    contains some meta-information about your application (like some copyright
   140    contains some meta-information about your application (like some copyright
   136    information, the version of your app, the name of an optional icon file,
   141    information, the version of your app, the name of an optional icon file,
   137    and other things). Part of that information is displayed by the Finder
   142    and other things). Part of that information is displayed by the Finder
   138    when you click on the .app, or if you look at the "Get Info" window.
   143    when you click on the .app, or if you look at the "Get Info" window.
   154 
   159 
   155 The first thing to do is to unpack the Xcode.tar.gz archive in the
   160 The first thing to do is to unpack the Xcode.tar.gz archive in the
   156 top level SDL directory (where the Xcode.tar.gz archive resides).
   161 top level SDL directory (where the Xcode.tar.gz archive resides).
   157 Because Stuffit Expander will unpack the archive into a subdirectory,
   162 Because Stuffit Expander will unpack the archive into a subdirectory,
   158 you should unpack the archive manually from the command line:
   163 you should unpack the archive manually from the command line:
   159 	cd [path_to_SDL_source]
   164 
   160 	tar zxf Xcode.tar.gz
   165     cd [path_to_SDL_source]
       
   166     tar zxf Xcode.tar.gz
       
   167 
   161 This will create a new folder called Xcode, which you can browse
   168 This will create a new folder called Xcode, which you can browse
   162 normally from the Finder.
   169 normally from the Finder.
   163 
   170 
   164 - Building the Framework
   171 - Building the Framework
   165 
   172