Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions go-example-webserver/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.DEFAULT_GOAL := snap

DESTDIR ?= .
SNAPNAME = $(shell find ./magic-bin/ -type f -printf "%f\n" | head -1)

magic-bin/x86_64-linux-gnu:
mkdir $(DESTDIR)/magic-bin/x86_64-linux-gnu --parents

magic-bin/arm-linux-gnueabihf:
mkdir $(DESTDIR)/magic-bin/arm-linux-gnueabihf --parents

build_amd64: magic-bin/x86_64-linux-gnu
cd $(DESTDIR)/magic-bin/x86_64-linux-gnu && \
go build ../../ && mv build $(SNAPNAME)

build_arm: magic-bin/arm-linux-gnueabihf
cd $(DESTDIR)/magic-bin/arm-linux-gnueabihf && \
GOARCH=arm go build ../../ && mv build $(SNAPNAME)

snap: build_amd64 build_arm
#snappy build .

install:
cp -R ../build/magic-bin ../install/

clean:
rm -rf ./magic-bin/x86_64-linux-gnu
rm -rf ./magic-bin/arm-linux-gnueabihf
rm -rf ./*multi.snap
12 changes: 1 addition & 11 deletions go-example-webserver/README
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,7 @@ to find the right architecture and launch the right binary.

To build simply do this:

# change to the x86_64 directory and build the binary...
1. cd magic-bin/x86_64-linux-gnu
2. go build ../../

# switch to the armhf directory and build for ARM
3. cd ../arm-linux-gnueabihf
4. GOARCH=arm go build ../../

# go to top level dir and build the snapp
5. cd ../..
6. snappy build .
snapcraft

This produces a snappy package for you that you can try on your snappy system.

Expand Down
File renamed without changes
13 changes: 0 additions & 13 deletions go-example-webserver/meta/package.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions go-example-webserver/meta/readme.md

This file was deleted.

18 changes: 18 additions & 0 deletions go-example-webserver/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: go-example-webserver
version: 1.0.7
vendor: Alexander Sack <asac@canonical.com>
summary: Go Webserver
description: "Minimal Golang webserver for snappy \n\nMostly a example to show how to build a binary webserver for snappy."
architectures: [armhf, amd64]
icon: go.png
services:
webserver:
description: "snappy example: golang mini webserver"
start: ./magic-bin/go-example-webserver
caps:
- networking
- network-service
parts:
magic-bin:
plugin: make
source: .