mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-22 08:25:38 +00:00
Merge pull request #104 from vbatts/multiple_builds_test
make: build for several platfom/arches
This commit is contained in:
commit
26ccc7a48c
3 changed files with 33 additions and 13 deletions
|
@ -16,3 +16,4 @@ install: true
|
||||||
script:
|
script:
|
||||||
- make validation
|
- make validation
|
||||||
- make validation.tags
|
- make validation.tags
|
||||||
|
- make build.arches
|
||||||
|
|
15
Makefile
15
Makefile
|
@ -4,6 +4,7 @@ CWD := $(shell pwd)
|
||||||
SOURCE_FILES := $(shell find . -type f -name "*.go")
|
SOURCE_FILES := $(shell find . -type f -name "*.go")
|
||||||
CLEAN_FILES := *~
|
CLEAN_FILES := *~
|
||||||
TAGS := cvis
|
TAGS := cvis
|
||||||
|
ARCHES := linux,386 linux,amd64 linux,arm linux,arm64 openbsd,amd64 windows,amd64 darwin,amd64
|
||||||
|
|
||||||
default: build validation
|
default: build validation
|
||||||
|
|
||||||
|
@ -60,6 +61,20 @@ build: $(BUILD)
|
||||||
$(BUILD): $(SOURCE_FILES)
|
$(BUILD): $(SOURCE_FILES)
|
||||||
go build ./cmd/$(BUILD)
|
go build ./cmd/$(BUILD)
|
||||||
|
|
||||||
|
./bin:
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
CLEAN_FILES += bin
|
||||||
|
|
||||||
|
build.arches: ./bin
|
||||||
|
@set -e ;\
|
||||||
|
for pair in $(ARCHES); do \
|
||||||
|
p=$$(echo $$pair | cut -d , -f 1);\
|
||||||
|
a=$$(echo $$pair | cut -d , -f 2);\
|
||||||
|
echo "Building $$p/$$a ...";\
|
||||||
|
GOOS=$$p GOARCH=$$a go build -o ./bin/gomtree.$$p.$$a ./cmd/gomtree/ ;\
|
||||||
|
done
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(BUILD) $(CLEAN_FILES)
|
rm -rf $(BUILD) $(CLEAN_FILES)
|
||||||
|
|
||||||
|
|
|
@ -10,28 +10,32 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
unameKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
// this is bsd specific https://www.freebsd.org/cgi/man.cgi?query=chflags&sektion=2
|
||||||
|
flagsKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
||||||
|
return emptyKV, nil
|
||||||
|
}
|
||||||
|
unameKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
||||||
if hdr, ok := info.Sys().(*tar.Header); ok {
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
||||||
return fmt.Sprintf("uname=%s", hdr.Uname), nil
|
return KeyVal(fmt.Sprintf("uname=%s", hdr.Uname)), nil
|
||||||
}
|
}
|
||||||
return "", nil
|
return emptyKV, nil
|
||||||
}
|
}
|
||||||
uidKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
uidKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
||||||
if hdr, ok := info.Sys().(*tar.Header); ok {
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
||||||
return fmt.Sprintf("uid=%d", hdr.Uid), nil
|
return KeyVal(fmt.Sprintf("uid=%d", hdr.Uid)), nil
|
||||||
}
|
}
|
||||||
return "", nil
|
return emptyKV, nil
|
||||||
}
|
}
|
||||||
gidKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
gidKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
||||||
if hdr, ok := info.Sys().(*tar.Header); ok {
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
||||||
return fmt.Sprintf("gid=%d", hdr.Gid), nil
|
return KeyVal(fmt.Sprintf("gid=%d", hdr.Gid)), nil
|
||||||
}
|
}
|
||||||
return "", nil
|
return emptyKV, nil
|
||||||
}
|
}
|
||||||
nlinkKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
nlinkKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
||||||
return "", nil
|
return emptyKV, nil
|
||||||
}
|
}
|
||||||
xattrKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
xattrKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
||||||
return "", nil
|
return emptyKV, nil
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue