golang.zx2c4.com/wireguard/windows@v0.5.4-0.20230123132234-dcc0eb72a04b/docs/buildrun.md (about)

     1  # Building, Running, and Developing
     2  
     3  ### Building
     4  
     5  Windows 10 64-bit or Windows Server 2019, and Git for Windows is required. The build script will take care of downloading, verifying, and extracting the right versions of the various dependencies:
     6  
     7  ```text
     8  C:\Projects> git clone https://git.zx2c4.com/wireguard-windows
     9  C:\Projects> cd wireguard-windows
    10  C:\Projects\wireguard-windows> build
    11  ```
    12  
    13  ### Running
    14  
    15  After you've built the application, run `amd64\wireguard.exe` or `x86\wireguard.exe` to install the manager service and show the UI.
    16  
    17  ```text
    18  C:\Projects\wireguard-windows> amd64\wireguard.exe
    19  ```
    20  
    21  Since WireGuard requires a driver to be installed, and this generally requires a valid Microsoft signature, you may benefit from first installing a release of WireGuard for Windows from the official [wireguard.com](https://www.wireguard.com/install/) builds, which bundles a Microsoft-signed driver, and then subsequently run your own wireguard.exe. Alternatively, you can craft your own installer using the `quickinstall.bat` script.
    22  
    23  ### Optional: Localizing
    24  
    25  To translate WireGuard UI to your language:
    26  
    27  1. Upgrade `resources.rc` accordingly. Follow the pattern.
    28  
    29  2. Make a new directory in `locales\` containing the language ID:
    30  
    31    ```text
    32    C:\Projects\wireguard-windows> mkdir locales\<langID>
    33    ```
    34  
    35  3. Configure and run `build` to prepare initial `locales\<langID>\messages.gotext.json` file:
    36  
    37     ```text
    38     C:\Projects\wireguard-windows> set GoGenerate=yes
    39     C:\Projects\wireguard-windows> build
    40     C:\Projects\wireguard-windows> copy locales\<langID>\out.gotext.json locales\<langID>\messages.gotext.json
    41     ```
    42  
    43  4. Translate `locales\<langID>\messages.gotext.json`. See other language message files how to translate messages and how to tackle plural. For this step, the project is currently using [CrowdIn](https://crowdin.com/translate/WireGuard); please make sure your translations make it there in order to be added here.
    44  
    45  5. Run `build` from the step 3 again, and test.
    46  
    47  6. Repeat from step 4.
    48  
    49  ### Optional: Creating the Installer
    50  
    51  The installer build script will take care of downloading, verifying, and extracting the right versions of the various dependencies:
    52  
    53  ```text
    54  C:\Projects\wireguard-windows> cd installer
    55  C:\Projects\wireguard-windows\installer> build
    56  ```
    57  
    58  ### Optional: Signing Binaries
    59  
    60  Add a file called `sign.bat` in the root of this repository with these contents, or similar:
    61  
    62  ```text
    63  set SigningCertificate=8BC932FDFF15B892E8364C49B383210810E4709D
    64  set TimestampServer=http://timestamp.entrust.net/rfc3161ts2
    65  ```
    66  
    67  After, run the above `build` commands as usual, from a shell that has [`signtool.exe`](https://docs.microsoft.com/en-us/windows/desktop/SecCrypto/signtool) in its `PATH`, such as the Visual Studio 2017 command prompt.
    68  
    69  ### Alternative: Building from Linux
    70  
    71  You must first have Mingw and ImageMagick installed.
    72  
    73  ```text
    74  $ sudo apt install mingw-w64 imagemagick
    75  $ git clone https://git.zx2c4.com/wireguard-windows
    76  $ cd wireguard-windows
    77  $ make
    78  ```
    79  
    80  You can deploy the 64-bit build to an SSH host specified by the `DEPLOYMENT_HOST` environment variable (default "winvm") to the remote directory specified by the `DEPLOYMENT_PATH` environment variable (default "Desktop") by using the `deploy` target:
    81  
    82  ```text
    83  $ make deploy
    84  ```
    85  
    86  ### [`wg(8)`](https://git.zx2c4.com/wireguard-tools/about/src/man/wg.8) Support for Windows
    87  
    88  The command line utility [`wg(8)`](https://git.zx2c4.com/wireguard-tools/about/src/man/wg.8) works well on Windows. Being a Unix-centric project, it compiles with a Makefile and MingW:
    89  
    90  ```text
    91  $ git clone https://git.zx2c4.com/wireguard-tools
    92  $ PLATFORM=windows make -C wireguard-tools/src
    93  $ stat wireguard-tools/src/wg.exe
    94  ```
    95  
    96  It interacts with WireGuard instances run by the main WireGuard for Windows program.
    97  
    98  When building on Windows, the aforementioned `build.bat` script takes care of building this.