Skip to content

Commit

Permalink
Initial inclusion of build system
Browse files Browse the repository at this point in the history
Signed-off-by: Ikey Doherty <ikey@solus-project.com>
  • Loading branch information
ikeydoherty committed Dec 6, 2016
1 parent 9328171 commit ea9c458
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/bin/
/pkg/
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
PROJECT_ROOT := src/
VERSION = 0.0.1

.DEFAULT_GOAL := all

# The resulting binaries map to the subproject names
BINARIES = \
binman

include Makefile.gobuild

_PKGS = \
binman

# We want to add compliance for all built binaries
_CHECK_COMPLIANCE = $(addsuffix .compliant,$(_PKGS))

# Build all binaries as static binary
BINS = $(addsuffix .statbin,$(BINARIES))

# Ensure our own code is compliant..
compliant: $(_CHECK_COMPLIANCE)
install: $(BINS)
test -d $(DESTDIR)/usr/bin || install -D -d -m 00755 $(DESTDIR)/usr/bin; \
install -m 00755 bin/* $(DESTDIR)/usr/bin/.;

ensure_modules:
@ ( \
git submodule init; \
git submodule update; \
);

# See: https://github.com/meitar/git-archive-all.sh/blob/master/git-archive-all.sh
release: ensure_modules
git-archive-all.sh --format tar.gz --prefix solbuild-$(VERSION)/ --verbose -t HEAD solbuild-$(VERSION).tar.gz

all: $(BINS)
27 changes: 27 additions & 0 deletions Makefile.gobuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
CUR_DIR = $(shell pwd)

# "Normal" static binary
%.statbin:
GOPATH=$(CUR_DIR) go install -v $(subst .statbin,,$@)

clean:
test ! -d $(CUR_DIR)/pkg || rm -rvf $(CUR_DIR)/pkg; \
test ! -d $(CUR_DIR)/bin || rm -rvf $(CUR_DIR)/bin

spellcheck:
@ ( \
misspell -error -i 'evolveos' `find $(PROJECT_ROOT) -not -path '*/vendor/*' -name '*.go'`; \
);

%.compliant: spellcheck
@ ( \
pushd "$(PROJECT_ROOT)/$(subst .compliant,,$@)" >/dev/null || exit 1; \
go fmt || exit 1; \
GOPATH=$(CUR_DIR)/ golint || exit 1; \
GOPATH=$(CUR_DIR)/ go vet || exit 1; \
);

%.test:
GOPATH=$(CUR_DIR) go test $(subst .test,,$@)

check: $(GO_TESTS)
27 changes: 27 additions & 0 deletions src/binman/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// Copyright © 2016 Ikey Doherty <ikey@solus-project.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

package main

import (
"fmt"
"os"
)

func main() {
fmt.Fprintf(os.Stderr, "Not yet implemented\n")
os.Exit(1)
}

0 comments on commit ea9c458

Please sign in to comment.