From db781221632e5229c585f0a2ebd734785e87af6a Mon Sep 17 00:00:00 2001 From: Sebastien Douheret Date: Thu, 18 Jan 2018 16:32:27 +0100 Subject: Update build instructions Change-Id: Icc394a4aa9c84bad77c69d1ebc54f2f2d53371db Signed-off-by: Sebastien Douheret --- .vscode/settings.json | 3 +- docs/part-2/1_Prerequisites.md | 31 ++++++++++++++----- docs/part-2/1_xds-server/3_build.md | 25 +++++++++++----- docs/part-2/2_xds-agent/3_build.md | 60 ++++++++++++++++++++++++++++--------- docs/part-2/3_xds-cli/3_build.md | 34 ++++++++++++++++----- docs/part-2/4_xds-gdb/2_build.md | 34 ++++++++++++++++----- 6 files changed, 141 insertions(+), 46 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index a8a8c97..4fd6d94 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,6 +17,7 @@ "LOGFILE", "RPATH", "DRSYNC", "usermod", "groupmod", "chown", "MACHINENAME", "glibc", "DESTDIR", "realpath", "GOARCH", "sdkid", "newtool", "setx", "autologin", "loginctl", "endwarning", "gerrit", - "raspberrypi", "qemux", "ulcb", "nogfx", "dragonboard", "EXEPATH" + "raspberrypi", "qemux", "ulcb", "nogfx", "dragonboard", "EXEPATH", + "ROOTDIR" ] } diff --git a/docs/part-2/1_Prerequisites.md b/docs/part-2/1_Prerequisites.md index fcaa031..29ba78b 100644 --- a/docs/part-2/1_Prerequisites.md +++ b/docs/part-2/1_Prerequisites.md @@ -1,13 +1,16 @@ # Prerequisites -To build xds binaries you need to install first [Go](https://golang.org/doc/install) version 1.8.1 or higher and some other tools. To build `xds-server` and `xds-agent` +XDS is written in Go and currently only build on Linux host has been validated. + +So to build XDS binaries you need to install first [Go](https://golang.org/doc/install) +version 1.8.1 or higher and some other tools. To build `xds-server` and `xds-agent` you also need to install in addition `nodejs`. **Ubuntu:** ```bash # Install various tools -sudo apt-get install git make npm curl git zip unzip +sudo apt-get install git make npm curl git zip unzip wget # Install Go source /etc/os-release @@ -17,10 +20,6 @@ deb http://ppa.launchpad.net/longsleep/golang-backports/ubuntu ${VERSION_CODENAM EOF" sudo apt-get update sudo apt-get install golang-go - -# Install nodejs LTS version and angular-cli (only mandatory for xds-server and xds-agent) -sudo npm install --global n @angular/cli -sudo n lts ``` **openSUSE:** @@ -36,9 +35,25 @@ sudo zypper ar http://download.opensuse.org/repositories/devel:/languages:/go/${ sudo zypper --gpg-auto-import-keys ref sudo zypper install go1.9 -# Install nodejs LTS version and angular-cli (only mandatory for xds-server and xds-agent) +# Install nodejs LTS version (only mandatory for xds-server and xds-agent) sudo npm install --global n @angular/cli sudo n lts ``` -Don't forget to open new user session after installing these packages. +> Don't forget to open new user session after installing these packages. + +**All Linux distro:** + +```bash +# Install nodejs LTS version (only mandatory for xds-server and xds-agent) +sudo npm install --global n +sudo n lts +``` + +Angular developers that's plan to modify XDS Dashboard webapp (part of +`xds-agent` repo) may also need angular cli tool named `ng` : + +```bash +# Install angular cli tool (ng) +sudo npm install --global n @angular/cli +``` diff --git a/docs/part-2/1_xds-server/3_build.md b/docs/part-2/1_xds-server/3_build.md index 92a90ea..5c5059f 100644 --- a/docs/part-2/1_xds-server/3_build.md +++ b/docs/part-2/1_xds-server/3_build.md @@ -11,25 +11,36 @@ Refer to [Prerequisites chapter](../1_Prerequisites.html) for more details. ### Native build -Create a GOPATH variable(must be a full path): +Clone sources under `$ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds/xds-server` +in order respect directory hierarchy that match Go package import logic (see +[How to Write Go Code](https://golang.org/doc/code.html) for more details). -```bash -export GOPATH=$(realpath ~/workspace_go) -``` - -Clone this repo into your `$GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds` and use delivered Makefile: +Then use delivered Makefile : ```bash -export GOPATH=${GOPATH}:${ROOTDIR} +# Declare ROOTDIR, can be any location (for example xds-build) +ROOTDIR=$HOME/xds-build +# Create directory hierarchy that match Go package import logic mkdir -p $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds cd $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds + +# Clone sources git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-server # or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-server + +# Build xds-server +# (note that GOPATH will correctly be set by Makefile) cd xds-server make all ``` +Generate xds-server package / tarball + +```bash +make package-all +``` + And to install `xds-server` (by default in `/opt/AGL/xds/server`): ```bash diff --git a/docs/part-2/2_xds-agent/3_build.md b/docs/part-2/2_xds-agent/3_build.md index ce1407d..842f582 100644 --- a/docs/part-2/2_xds-agent/3_build.md +++ b/docs/part-2/2_xds-agent/3_build.md @@ -9,29 +9,61 @@ Refer to [Prerequisites chapter](../1_Prerequisites.html) for more details. ## Building -Clone this repo into your `$GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds` and use delivered Makefile: +Clone sources under `$ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds/xds-agent` +in order respect directory hierarchy that match Go package import logic (see +[How to Write Go Code](https://golang.org/doc/code.html) for more details). + +Then use delivered Makefile : + +```bash +# Declare ROOTDIR, can be any location (for example xds-build) +ROOTDIR=$HOME/xds-build + +# Create directory hierarchy that match Go package import logic +mkdir -p $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds +cd $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds + +# Clone sources +git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-agent +# or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-agent + +# Build xds-agent +# (note that GOPATH will correctly be set by Makefile) +cd xds-agent +make all +``` + +Generate xds-agent packages / tarballs for Linux, MacOS, Windows ```bash - mkdir -p $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds - cd $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds - git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-agent - # or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-agent - cd xds-agent - make all +make package-all ``` -And to install xds-agent (by default in `/usr/local/bin`): +And to install `xds-agent` (by default in `/opt/AGL/xds/agent`): ```bash make install ``` ->**Note:** -> ->Used `DESTDIR` to specify another install directory ->```bash ->make install DESTDIR=$HOME/opt/xds-agent ->``` + +**Warning:** + +Makefile install rule and default values in configuration file are set +to fit the docker setup. + +So you may need to adapt some settings when you want to install xds-agent natively. + + + +**Note:** + +Used `DESTDIR` to specify another install directory + +```bash +make install DESTDIR=$HOME/opt/xds-agent +``` + + ### Cross build diff --git a/docs/part-2/3_xds-cli/3_build.md b/docs/part-2/3_xds-cli/3_build.md index ba2d83b..b42b00c 100644 --- a/docs/part-2/3_xds-cli/3_build.md +++ b/docs/part-2/3_xds-cli/3_build.md @@ -8,14 +8,32 @@ Refer to [Prerequisites chapter](../1_Prerequisites.html) for more details. ## Building -Clone this repo into your `$GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds` and use delivered Makefile: +Clone sources under `$ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds/xds-cli` +in order respect directory hierarchy that match Go package import logic (see +[How to Write Go Code](https://golang.org/doc/code.html) for more details). + +Then use delivered Makefile : + +```bash +# Declare ROOTDIR, can be any location (for example xds-build) +ROOTDIR=$HOME/xds-build + +# Create directory hierarchy that match Go package import logic +mkdir -p $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds +cd $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds + +# Clone sources +git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-cli +# or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-cli + +# Build xds-cli +# (note that GOPATH will correctly be set by Makefile) +cd xds-cli +make all +``` + +Generate xds-cli package / tarball ```bash - export GOPATH=$(realpath ~/workspace_go) - mkdir -p $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds - cd $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds - git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-cli - # or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-cli - cd xds-cli - make +make package-all ``` diff --git a/docs/part-2/4_xds-gdb/2_build.md b/docs/part-2/4_xds-gdb/2_build.md index 5cc0ca8..9ec91b3 100644 --- a/docs/part-2/4_xds-gdb/2_build.md +++ b/docs/part-2/4_xds-gdb/2_build.md @@ -8,14 +8,32 @@ Refer to [Prerequisites chapter](../1_Prerequisites.html) for more details. ## Building -Clone this repo into your `$GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds` and use delivered Makefile: +Clone sources under `$ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds/xds-gdb` +in order respect directory hierarchy that match Go package import logic (see +[How to Write Go Code](https://golang.org/doc/code.html) for more details). + +Then use delivered Makefile : + +```bash +# Declare ROOTDIR, can be any location (for example xds-build) +ROOTDIR=$HOME/xds-build + +# Create directory hierarchy that match Go package import logic +mkdir -p $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds +cd $ROOTDIR/src/gerrit.automotivelinux.org/gerrit/src/xds + +# Clone sources +git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-gdb +# or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-gdb + +# Build xds-gdb +# (note that GOPATH will correctly be set by Makefile) +cd xds-gdb +make all +``` + +Generate xds-gdb package / tarball ```bash - export GOPATH=$(realpath ~/workspace_go) - mkdir -p $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds - cd $GOPATH/src/gerrit.automotivelinux.org/gerrit/src/xds - git clone https://gerrit.automotivelinux.org/gerrit/src/xds/xds-gdb - # or git clone ssh://YOUR_USERNAME@gerrit.automotivelinux.org:29418/src/xds/xds-gdb - cd xds-gdb - make +make package-all ``` -- cgit 1.2.3-korg