How to: build Brave on Windows

windows

#1

Installing the prerequisites

Git

Git for Windows is a good choice because it includes MinGW (Minimalist GNU for Windows)

Besides supporting all of the git commands you know and love, you can import your dotfiles from Mac or Linux to help make dev easier.

node.js

Download link

NOTE: Please choose the LTS version and also make sure you pick the right architecture for your machine (32-bit vs 64-bit)

Once the install is complete, you’ll want to open a new command window to run the following:

  • npm config set python python2.7
  • npm config set msvs_version 2015 --global

C++ Compilers

You can either use Visual Studio or the standalone C++ tools.

Visual C++ 2015 Standalone Build Tools

Download the Standalone compiler, libraries and scripts installer.

Visual Studio 2015 with update 2 or newer

You can find VS 2015 available in MSDN and possibly elsewhere.

When the installer comes up, here are the items you need installed:

  • everything under Programming Languages > Visual C++
  • Windows 10 SDK via Universal Windows App Development Tools > Windows 10 SDK
  • Windows 8.1 SDK via Windows 8.1 and Windows Phone 8.0/8.1 Tools > Tools and Windows SDKs

This install will take a while. Kick it off, take a break, and come back later to see how it’s going.

OpenSSL

This is required for secp256k1-node

It’s very important that you:

NOTE: If you don’t install this properly, you’ll see an error like this when running npm install:

LINK : fatal error LNK1181: cannot open input file 'C:\OpenSSL-Win64\lib\libeay32.lib' [C:\Users\brian\Documents\GitHub \browser-laptop\node_modules\secp256k1\build\secp256k1.vcxproj]

Python 2.7

Download link

Make sure to add the install path to your PATH environment variable (default path is C:\Python27). A system reboot is required if the path has been added manually.

Environment variables

Here’s a link with more information if you’re not familiar with environment variables.

Let’s create the following system variables:

  • CHANNEL = dev
  • GYP_MSVS_VERSION = 2015

Let’s check the system PATH variable. Changes shouldn’t be required if you followed the installer properly, but it can’t hurt to check. If the values are NOT already there, you’ll want to append:

  • The PATH for your Python install (default is C:\Python27)
  • The PATH for your nodejs install (default is C:\Program Files\nodejs\)

Depending on your system, a reboot may be required for these variable changes to take effect.

Getting the code

Open a new command window (make sure it’s the shell you picked for your Git client). Pick a parent directory on your machine and run a git clone.

cd ~\Documents\GitHub\

# For beta testers:
git clone --depth 1 https://github.com/brave/browser-laptop

# For devs over HTTPS:
git clone https://github.com/brave/browser-laptop

# For devs over SSH:
git clone git@github.com:brave/browser-laptop.git

cd browser-laptop

Building

NOTE: If you’re following this guide, please don’t build Brave using Cygwin. Cygwin includes C/C++ compilers which causes complications when tasks are run which compile code (ex: npm install). Cygwin is fine to use for editing in vim, navigation, and git.

Before running this step, you may consider increasing the buffer size of your window, in case any errors show up. You can do this by right-clicking in the title and click properties (or for msys2 based shells like Git for Windows, right click > options, windows).

In your command window, at the root of the project (the browser-laptop folder), run:
npm install

This step will take a while. It’s going to install modules needed, some which need to be compiled from source.

Running

You need to open two command line windows.

  • Window 1
  • npm run watch
  • Window 2
  • npm start

For the latest status, please see https://github.com/brave/browser-laptop/wiki/(setup)-Windows-build-guide


#2

#3

#4

If you have some better steps or find the wrong procedure in the guide. please let me know by creating a new topic from the permalink of this topic :smile:

Thanks!