Multi-target build

Try to customize the MakeFile in order to be able to build an binary for
any target system.
This commit is contained in:
Bertrand Moreau 2020-08-18 17:18:45 +02:00 committed by Zorglube
parent 81cf970d68
commit c1c793988f
2 changed files with 8 additions and 30 deletions

View File

@ -5,10 +5,13 @@
# For info on installing extra versions, see this page: # For info on installing extra versions, see this page:
# https://golang.org/doc/install#extra_versions # https://golang.org/doc/install#extra_versions
# goosList = "android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows"
# goarchList = "386 amd64 amd64p32 arm arm64 ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32leppc s390 s390x sparc sparc64"
TAGS= TAGS=
# Windows needs the .exe extension. # Windows needs the .exe extension.
ifeq ($(OS),Windows_NT) ifeq ($(TARGET),windows)
EXT=.exe EXT=.exe
endif endif
@ -19,9 +22,9 @@ all: fmt vet test MovieNight$(EXT) static/main.wasm settings.json
# Build the server deployment # Build the server deployment
server: ServerMovieNight static/main.wasm server: ServerMovieNight static/main.wasm
# Build used for deploying to my server. # Bulid used for deploying to my server.
ServerMovieNight: *.go common/*.go ServerMovieNight: *.go common/*.go
GOOS=${OS} GOARCH=${ARCH} go$(GO_VERSION) build -o MovieNight $(TAGS) GOOS=${TARGET} GOARCH=${ARCH} go$(GO_VERSION) build -o MovieNight $(TAGS)
setdev: setdev:
$(eval export TAGS=-tags "dev") $(eval export TAGS=-tags "dev")
@ -29,7 +32,7 @@ setdev:
dev: setdev all dev: setdev all
MovieNight$(EXT): *.go common/*.go MovieNight$(EXT): *.go common/*.go
GOOS=${OS} GOARCH=${ARCH} go$(GO_VERSION) build -o $@ $(TAGS) go$(GO_VERSION) build -o $@ $(TAGS)
static/js/wasm_exec.js: static/js/wasm_exec.js:
cp $$(go env GOROOT)/misc/wasm/wasm_exec.js $@ cp $$(go env GOROOT)/misc/wasm/wasm_exec.js $@

View File

@ -1,9 +1,6 @@
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc --> <!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc -->
**Table of Contents** **Table of Contents**
<<<<<<< HEAD
=======
>>>>>>> Changed EOL into readme.md
- [MovieNight stream server](#movienight-stream-server) - [MovieNight stream server](#movienight-stream-server)
- [Build requirements](#build-requirements) - [Build requirements](#build-requirements)
- [Older Go Versions](#older-go-versions) - [Older Go Versions](#older-go-versions)
@ -19,10 +16,7 @@
<!-- markdown-toc end --> <!-- markdown-toc end -->
# MovieNight stream server # MovieNight stream server
<<<<<<< HEAD
=======
>>>>>>> Changed EOL into readme.md
[![Build status](https://api.travis-ci.org/zorchenhimer/MovieNight.svg?branch=master)](https://travis-ci.org/zorchenhimer/MovieNight) [![Build status](https://api.travis-ci.org/zorchenhimer/MovieNight.svg?branch=master)](https://travis-ci.org/zorchenhimer/MovieNight)
This is a single-instance streaming server with chat. Originally written to This is a single-instance streaming server with chat. Originally written to
@ -30,18 +24,11 @@ replace Rabbit as the platform for watching movies with a group of people
online. online.
## Build requirements ## Build requirements
<<<<<<< HEAD
=======
>>>>>>> Changed EOL into readme.md
- Go 1.13 or newer - Go 1.13 or newer
- GNU Make - GNU Make
### Older Go Versions ### Older Go Versions
<<<<<<< HEAD
=======
>>>>>>> Changed EOL into readme.md
You can install a newer version of Go alongside your OS's distribution by You can install a newer version of Go alongside your OS's distribution by
following the guide here: [https://golang.org/doc/install#extra_versions](https://golang.org/doc/install#extra_versions) following the guide here: [https://golang.org/doc/install#extra_versions](https://golang.org/doc/install#extra_versions)
@ -57,11 +44,7 @@ You have to :
- build **make TARGET=windows ARCH=386**; - build **make TARGET=windows ARCH=386**;
- and run **./MovieNight**; - and run **./MovieNight**;
<<<<<<< HEAD
Example : Example :
=======
Example :
>>>>>>> Changed EOL into readme.md
```bash ```bash
$ git clone https://github.com/zorchenhimer/MovieNight $ git clone https://github.com/zorchenhimer/MovieNight
$ cd MovieNight $ cd MovieNight
@ -107,13 +90,11 @@ This docker-compose file will create a volume called *movienight-config* and aut
The container needs to be restarted to apply any changes you make to *settings.json*. The container needs to be restarted to apply any changes you make to *settings.json*.
### FreeNAS - FreeBSD build and run ### FreeNAS - FreeBSD build and run
An script wich setup an Jail and build and run MovieNight into that Jail as been writen, you'll find it here [freenas-iocage-movienight] (https://github.com/zorglube/freenas-iocage-movienight) An script wich setup an Jail and build and run MovieNight into that Jail as been writen, you'll find it here [freenas-iocage-movienight] (https://github.com/zorglube/freenas-iocage-movienight)
## Usage ## Usage
<<<<<<< HEAD
=======
>>>>>>> Changed EOL into readme.md
Now you can use OBS to push a stream to the server. Set the stream URL to Now you can use OBS to push a stream to the server. Set the stream URL to
```text ```text
@ -158,10 +139,7 @@ Usage of .\MovieNight.exe:
``` ```
## Configuration ## Configuration
<<<<<<< HEAD
=======
>>>>>>> Changed EOL into readme.md
MovieNights configuration is controlled by `settings.json`: MovieNights configuration is controlled by `settings.json`:
- `AdminPassword`: users can enter `/auth <value>` into chat to grant themselves - `AdminPassword`: users can enter `/auth <value>` into chat to grant themselves
@ -201,8 +179,5 @@ MovieNights configuration is controlled by `settings.json`:
header, to prevent caching responses. header, to prevent caching responses.
## License ## License
<<<<<<< HEAD
=======
>>>>>>> Changed EOL into readme.md
`flv.js` is Licensed under the Apache 2.0 license. This project is licened under the MIT license. `flv.js` is Licensed under the Apache 2.0 license. This project is licened under the MIT license.