Building On Windows

From Audacity Wiki
Jump to: navigation, search
ToDo-2 Add
  • Instructions for building modules
These are instructions for building on Windows

The build family of pages:

Instructions in win/build.txt

These instructions for building on Windows are in win/build.txt in the Git repo.
Instructions for building on Windows.

Fuller instructions that include 
   * Portable Settings
   * Building an Installer
can be found on our wiki at http://wiki.audacityteam.org/wiki/Building_On_Windows


1. MSVC 2017: Download and install Microsoft Visual Studio 2017

 https://docs.microsoft.com/en-us/visualstudio/install/install-visual-studio?view=vs-2017

2. Git: Download and install Git, for example by installing:

  Git for Windows: https://git-scm.com/download/win
  and optionally GitExtensions: http://gitextensions.github.io/

 download and run the .msi installer.  GitExtensions has a GUI interface, includes Git for
 Windows and has a Git bash command line in the bottom panel of the screen.

3. wxWidgets:

 1) Clone wxWidgets and checkout 3.1.1 from the Audacity fork of the 
    wxWidgets project: 
       https://github.com/audacity/wxWidgets/

    for example, in the git-bash command line
      mkdir ./wxWidgets
      cd ./wxWidgets
      git clone --recurse-submodules https://github.com/audacity/wxWidgets/
      
    IF you forgot the --recurse-submodules, you can correct that later by:
      git submodule update --init

  2) Follow instructions for building at 
    https://github.com/audacity/wxWidgets/blob/v3.1.1/README-GIT.md
    https://github.com/audacity/wxWidgets/blob/v3.1.1/docs/msw/install.txt

    DO set WXWIN to the appropriate directory where you installed wxWidgets.
    To do that, open a cmd.exe window, and type: 
       set WXWIN=C:\wxWidgets-3.1.1

    You will be building a dll version with MSVC2017 IDE, so...

    In MSVC 2017 open wx_vc15.sln, and select dll, release.
    Then build.

  3) Having got this far, it is well worth trying out building some wxWidgets
    examples to confirm that building has worked OK

4. Audacity

 1) Clone Audacity from the Audacity GitHub project.
       https://github.com/audacity/audacity/

    for example, in the git-bash command line
      mkdir ./audacity
      cd ./audacity
      git clone https://github.com/audacity/audacity/

    Audacity itself does not use/need git submodules.

  2) in MSVC 2017 open audacity.sln
    Choose Release or Debug.
    Click compile.

Variations

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

Defaulting to Portable Settings

 UH?  These instructions are for Mac.
 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"


Optional Features

Some functionality in Audacity is currently turned on in its default
configuration, but requires that extra libraries be downloaded
separately to use it. 

To change the libraries enabled in Audacity, edit  
"win\configwin.h" and comment or uncomment the entries.

You might also try modifying the features enabled in 
"src\experiemntal.h"


Supporting ASIO

ASIO (from Steinberg) is a sound card interface protocol that is faster
than standard WMME. Unlike WMME, not all soundcard drivers support it.

Because ASIO is a proprietary, closed standard, we (or any third party)
cannot distribute its SDK. That means we cannot distribute builds of
Audacity that support ASIO, because Audacity is licensed under the GPL 
(http://audacityteam.org/about/license), which requires we
distribute all source code. 

So, although you can build your own copies of Audacity with 
ASIO support, for personal use, you cannot distribute them without 
violating the Audacity license and the ASIO license. 
If you build ASIO support into Audacity, do not distribute that build. 

For ASIO support, get the ASIO SDK from Steinberg 
(http://www.steinberg.net/en/company/developers.html), 
install at C:\ASIOSDK, then define an environment variable called
ASIOSDK_DIR.

The value should be the full path to the base directory of the
ASIO SDK, e.g.,

   set ASIOSDK_DIR=C:\ASIOSDK

Official Full Releases

Official full releases:

  • Have a GitIdent, visible in the about box build information, that says what branch was used in building.
  • Come with translations
  • May be as a zip file
    • No manual provided
  • May be as a windows installer.
    • These come with help files in html format.
  • Are signed.

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/
 using the git-bash command  line
 
   bash 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

Fetching The Manual

We have instructions for fetching the manual on another page.


Preparing Languages

In the MSVC project languages are not built by default, so be careful you are not using an out of date version of the translations for release.
  1.  In the MSVC project, click on 'locale' project and build.


It looks like this step is historic and no longer needs to be done.
 1. Open the "gl_ES", "ko_KR" and "pt" folders in turn and move the "wxstd.mo" file 
    in each to the "gl", "ko" and pt_PT folders respectively.
 2. Delete the "gl_ES", ko_KR and "pt" folders.
 3. COPY (do not move) wxstd.mo from "eu" into "eu_ES".

Building the Installer

The Inno setup installer requires certain files in certain places to be able to produce the installer.

 1. Copy msvcp140.dll and vcruntime140.dll from 
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.14.26405\x86\Microsoft.VC141.CRT
    to \win\release

    The 64 bit version will not work on 32 bit machines.

Now to actually make the installer...

  1. Install the latest Unicode Inno Setup (http://www.jrsoftware.org/isinfo.php). 
  2. Open the Inno Setup script:
       \win\audacity.iss
  3. Click 'Compile'.
Bulb icon  
  • If installing on Windows 8 or 10, you will need to set permissions on the C:\Program Files (x86)\Inno Setup 5\Languages\dummy directory to allow .isl files to be written there.
  • You will also need to obtain the 'unofficial' .isl files yourself and place them in C:\Program Files (x86)\Inno Setup 5\Languages\unofficial. They aren't installed by Inno setup, but you can obtain them from GitHub.

Making the Zip File

Do this step after making and testing the installer.

  Having installed from the installer

  1. Use 7-zip to create a new archive from the installed files excluding:
    - The manual
    - The unins* files
    - FirstTimeInit.txt

Note that the .exe in this zip file and dlls are not code signed. Audacity loads dlls dynamically at run time, possibly unsigned ones, so signing the exe itself is misleading for security. The integrity and security of the zip file is provided by its published checksukm. The situation is different for the installer where the code signature protects the entire bundle.


Signing the Installer

More detailed information on obtaining and verifying the cert is available at Codesigning On Windows

Codesigning uses a USB dongle (smart card reader) and a timestamp server at certum:

signtool sign /n "James Crook" /t http://time.certum.pl/ /fd sha256 /v <path-to-audacity-git>\win\Output\audacity-win-2.3.0.exe
Bulb icon To test the signing, upload the installer to dropbox and then download it again. Then double-click to open. When you launch Audacity, you now get a warning about having downloaded from the internet, with the identity of the signing key shown.