1 <!-- WARNING: This file is generated by fetch_docs.js using /home/boron/Documents/AGL/docs-webtemplate/site/_data/tocs/devguides/master/xds-docs-guides-devguides-book.yml -->
3 # Build xds-agent from scratch
7 Install [Go](https://golang.org/doc/install), [npm](https://www.npmjs.com/),
8 [nodejs](https://nodejs.org/en/) and some other tools.
10 Refer to [Prerequisites chapter](../1_Prerequisites.html) for more details.
14 Clone sources under `$ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds/xds-agent`
15 in order respect directory hierarchy that match Go package import logic (see
16 [How to Write Go Code](https://golang.org/doc/code.html) for more details).
18 Then use delivered Makefile :
21 # Declare ROOTDIR, can be any location (for example xds-build)
22 ROOTDIR=$HOME/xds-build
24 # Create directory hierarchy that match Go package import logic
25 mkdir -p $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds
26 cd $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds
29 git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-agent
30 # or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-agent
33 # (note that GOPATH will correctly be set by Makefile)
38 Generate xds-agent packages / tarballs for Linux, MacOS, Windows
44 And to install `xds-agent` (by default in `/opt/AGL/xds/agent`):
50 <!-- section-warning -->
53 Makefile install rule and default values in configuration file are set
54 to fit the docker setup.
56 So you may need to adapt some settings when you want to install xds-agent natively.
57 <!-- end-section-warning -->
62 Used `DESTDIR` to specify another install directory
65 make install DESTDIR=$HOME/opt/xds-agent
68 <!-- end-section-note -->
72 For example on a Linux machine to cross-build for Windows, just follow these steps.
74 The first time you need to install all the windows-amd64 standard packages on
78 # List all supported OS / ARCH
81 # Install all standard packages for another OS/ARCH (eg. windows amd64)
82 GOOS=windows GOARCH=amd64 go install -v -a std
85 Then compile and package xds-agent using provided makefile