Difference between revisions of "Building On Mac"

From Audacity Wiki
Jump to: navigation, search
(Added Portable Settings / Declutter dmg.)
(Use <pre> to make instructions cleaner.)
Line 4: Line 4:
 
These instructions for building on mac are in mac/Build.txt in the Git repo.
 
These instructions for building on mac are in mac/Build.txt in the Git repo.
  
 +
<pre>
 
  At this time, the newest SDK version that Audacity can build with is 10.6.  
 
  At this time, the newest SDK version that Audacity can build with is 10.6.  
 
  To build Audacity using Xcode 5.1 or newer, you need to extract the 10.6 SDK
 
  To build Audacity using Xcode 5.1 or newer, you need to extract the 10.6 SDK
Line 85: Line 86:
 
     ./configure
 
     ./configure
 
     sudo make install
 
     sudo make install
 
+
</pre>
  
 
==More Detailed Wiki Instructions ==
 
==More Detailed Wiki Instructions ==
Line 95: Line 96:
 
Rather than downloading our patched wxWidgets, you can download 3.0.2 and patch it yourself
 
Rather than downloading our patched wxWidgets, you can download 3.0.2 and patch it yourself
  
 +
<pre>
 
   Apply the following fixes to wxWidgets:
 
   Apply the following fixes to wxWidgets:
 
   
 
   
Line 105: Line 107:
 
   patch -p0 -i <path to Audacity source>/mac/wxMac_additions/tooldock-quit.patch .
 
   patch -p0 -i <path to Audacity source>/mac/wxMac_additions/tooldock-quit.patch .
 
   patch -p0 -i <path to Audacity source>/mac/wxMac_additions/fullscreen.patch .
 
   patch -p0 -i <path to Audacity source>/mac/wxMac_additions/fullscreen.patch .
 +
</pre>
  
 
The patches and their reasons can be found [https://github.com/audacity/wxWidgets/commits/audacity-fixes here], and there is more description about them [[For_Upstream_wxWidgets|here]] in the wiki.
 
The patches and their reasons can be found [https://github.com/audacity/wxWidgets/commits/audacity-fixes here], and there is more description about them [[For_Upstream_wxWidgets|here]] in the wiki.
Line 110: Line 113:
 
===Updating GitIdent===
 
===Updating GitIdent===
  
 +
<pre>
 
  The Audacity "About" box can contain a link to the git commit at which  
 
  The Audacity "About" box can contain a link to the git commit at which  
 
  Audacity was built. To create this, run this batch script in /mac/scripts/
 
  Audacity was built. To create this, run this batch script in /mac/scripts/
Line 124: Line 128:
 
   
 
   
 
   git reset -hard origin/master
 
   git reset -hard origin/master
 +
</pre>
 
   
 
   
  
 
===Signing the DMG===
 
===Signing the DMG===
  
 +
<pre>
 
  1) Comment out the last line of mac/scripts/build_dist.sh so that it reads
 
  1) Comment out the last line of mac/scripts/build_dist.sh so that it reads
 
   
 
   
Line 145: Line 151:
 
  4) mount the dmg
 
  4) mount the dmg
 
     hdiutil mount TMP.dmg
 
     hdiutil mount TMP.dmg
 +
 +
4a) Not part of the signing, but a good idea to de-clutter the dmg
 +
    per instructions in one of the next sections.
 
   
 
   
 
  5) Codesign the app (deep to make sure everything important is signed)
 
  5) Codesign the app (deep to make sure everything important is signed)
Line 165: Line 174:
 
   
 
   
 
     codesign -s <identity> -v Newname.dmg
 
     codesign -s <identity> -v Newname.dmg
 +
</pre>
 
   
 
   
  
Line 172: Line 182:
 
===Defaulting to Portable Settings===
 
===Defaulting to Portable Settings===
  
 +
<pre>
 
  1. Within audacity.app/Contents add the directories:
 
  1. Within audacity.app/Contents add the directories:
 
     Portable Settings
 
     Portable Settings
Line 179: Line 190:
 
     chmod 777 "Portable Settings"
 
     chmod 777 "Portable Settings"
 
     chmod 777 "Portable Settings/AutoSave"
 
     chmod 777 "Portable Settings/AutoSave"
 +
</pre>
  
 
These steps should of course be done before signing.
 
These steps should of course be done before signing.
Line 184: Line 196:
 
===Decluttered dmg===
 
===Decluttered dmg===
  
 +
<pre>
 
  1. Open the dmg
 
  1. Open the dmg
  
Line 191: Line 204:
  
 
  4. Drag right border narrower again.
 
  4. Drag right border narrower again.
 +
</pre>
 +
 
[[Category:Mac Platform]] [[Category:For Developers]]
 
[[Category:Mac Platform]] [[Category:For Developers]]

Revision as of 20:22, 26 February 2017

Instructions in mac/Build.txt

These instructions for building on mac are in mac/Build.txt in the Git repo.

 At this time, the newest SDK version that Audacity can build with is 10.6. 
 To build Audacity using Xcode 5.1 or newer, you need to extract the 10.6 SDK
 from an earlier version of Xcode.

 In the instructions below, Xcode 4.3.3 (for the 10.6 SDK) and Xcode 8.1 will
 be used.  Fuller instructions that cover 
    * Using other Xcodes
    * Optional signing of DMGs
    * Applying wxWidgets patches one by one
 can be found on our wiki at http://wiki.audacityteam.org/wiki/Building_On_Mac.
 
 1) Download Xcode 8.1 and install it to /Applications.
 2) Download Xcode 4.3.3 (it includes the 10.6 and 10.7 SDK's despite 
    the downloads page says it only has the 10.7 SDK).
 3) Open the DMG in Finder.
 4) Right-click the "Xcode.app" bundle and select "Show Package Contents".
 5) Navigate down the directories to get to:
 
    Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ .
 
 6) Copy the MacOSX10.6.sdk folder to:
 
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
 
 7) Change the MinimumSDKVersion key value in 
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist 
    to 10.6
 
    Xcode is now ready.
 
 8) Download Audacity's patched wxWidgets 3.0.2 zip from the Audacity fork of the 
    wxWidgets project: 
       https://github.com/audacity/wxWidgets/tree/audacity-fixes
 
    (use the green "clone or download" button on the right).
 
    Don't be tempted to use Widgets already installed by a package manager such 
    as Homebrew because this will cause problems.              
 
 9) Once the download is complete, unzip it:
 
    unzip wxWidgets-audacity-fixes.zip
 
 10) And finally build/install wxWidgets:
 
    sudo <path to Audacity source>/mac/build_wxwidgets .
 
 You should now be able to build Audacity using either the Xcode application or 
 the Xcodebuild command line tool. Using xcodebuild: 
 
 * Change directory to <path to Audacity source>/mac.
 
 * Optionally, if you have built before, clean the Debug build with:
   xcodebuild clean
 
 * If you built the Release build, clean with:
   xcodebuild clean -configuration Release  
 
 * Build Audacity and create DMG and ZIP bundles in 
   /private/tmp by typing the following in the terminal:
 
   xcodebuild -configuration Release install   
 
 * If you use the Xcode application, don't make any changes to 
   Audacity.xcodeproj recommended by Xcode. In particular, be sure to leave the
   Base SDK configuration set to 10.6 as it is now. 
 
 If you need Audacity to show languages other than English, install the gettext
 suite of tools (to get the msgfmt command).  The source can be downloaded from:
 
    ftp://ftp.gnu.org/gnu/gettext/gettext-latest.tar.gz
 
 Untar it:
 
    tar xf gettext-latest.tar.gz
 
 And install:
 
    cd gexttext-latest
    ./configure
    sudo make install

More Detailed Wiki Instructions

These instructions for variations on building aren't in mac/build.txt in the Git repo.

Using wxWidgets from wxWidgets

Rather than downloading our patched wxWidgets, you can download 3.0.2 and patch it yourself

  Apply the following fixes to wxWidgets:
 
   cd wxWidgets-3.0.2
   patch -p0 -i <path to Audacity source>/mac/wxMac_additions/wxMac-3.0.2-fixes.patch .
   patch -p0 -i <path to Audacity source>/mac/wxMac_additions/eventloops.patch .
   patch -p0 -i <path to Audacity source>/mac/wxMac_additions/pinch-spread.patch .
   patch -p0 -i <path to Audacity source>/mac/wxMac_additions/focusrings.patch .
   patch -p0 -i <path to Audacity source>/mac/wxMac_additions/wxMac-3.0.2-wxaccessible.patch .
   patch -p0 -i <path to Audacity source>/mac/wxMac_additions/tooldock-quit.patch .
   patch -p0 -i <path to Audacity source>/mac/wxMac_additions/fullscreen.patch .

The patches and their reasons can be found here, and there is more description about them here in the wiki.

Updating GitIdent

 The Audacity "About" box can contain a link to the git commit at which 
 Audacity was built. To create this, run this batch script in /mac/scripts/
 
   get_gitident.sh
 
 If you do this, you are responsible for making sure the ident is correct
 in future builds.  The script overwrites RevisionIdent.h in the src directory.
 If you make further changes to your local copy after this step, or merge a
 more recent version from git, this file, and hence the ident in the build, 
 stays the same, and so would be misleading.
 
 To reset RevisionIdent.h you could do:
 
   git reset -hard origin/master


Signing the DMG

 1) Comment out the last line of mac/scripts/build_dist.sh so that it reads
 
   #rm -rf ${DMG} TMP.dmg
 
   This will prevent deletion of TMP.dmg
 
 2) Clean and build Audacity normally.
 
 3) Navigate to /private/tmp/ and type 
 
    hdiutil resize -size 200m TMP.dmg
 
    This step is needed as codesigning takes some temporary space, more than is 
    available in the dmg.
 
 4) mount the dmg
    hdiutil mount TMP.dmg

 4a) Not part of the signing, but a good idea to de-clutter the dmg
    per instructions in one of the next sections.
 
 5) Codesign the app (deep to make sure everything important is signed)
     
    codesign --deep -s <identity> -v "/Volumes/Audacity 2.1.3/Audacity.app"
 
 6) Check it is signed to gatekeeper's satisfaction:
 
    spctl -a -v "/Volumes/Audacity 2.1.3/Audacity.app"
 
 7) unmount the dmg

    eject TMP.dmg
 
 8) Make a compressed dmg
 
    hdiutil convert TMP.dmg -format UDZO -imagekey zlib-level=9 -o "Newname.dmg"
 
 9) codesign that
 
    codesign -s <identity> -v Newname.dmg


To test the signing, upload the dmg to dropbox and then download it again. Then double-click to install and drag across to /Applications. When you launch Audacity, you now get a warning about having downloaded from the internet, rather than being prevented from running...

Defaulting to Portable Settings

 1. Within audacity.app/Contents add the directories:
    Portable Settings
    Portable Settings/AutoSave

 2. Set permissions on these two directories to 777
    chmod 777 "Portable Settings"
    chmod 777 "Portable Settings/AutoSave"

These steps should of course be done before signing.

Decluttered dmg

 1. Open the dmg

 2. Drag the right border wider.

 3. Drag all folders that should not be visible into that area.

 4. Drag right border narrower again.