Skip to content

Commit 38b4420

Browse files
authored
Merge pull request #12 from apertussolutions/rework
Rework repository layout
2 parents 0cb8304 + 63f18ca commit 38b4420

15 files changed

Lines changed: 99 additions & 717 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bin

‎Makefile‎

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,63 @@
11
# Go parameters
22
GOCMD=go
3+
GOMOD=$(GOCMD) mod
34
GOBUILD=$(GOCMD) build
5+
GOINSTALL=$(GOCMD) install
46
GOCLEAN=$(GOCMD) clean
57
GOTEST=$(GOCMD) test
6-
GOGET=$(GOCMD) get
7-
STATIC_FLAGS=-a -ldflags '-s -w -extldflags "-static"'
8+
GOVET=$(GOCMD) vet
89

9-
all: build-all-static
10+
current_dir := $(dir $(abspath $(firstword $(MAKEFILE_LIST))))
11+
GOBIN ?= $(current_dir)/bin
12+
13+
prefix = /usr
14+
exec_prefix = $(prefix)
15+
bindir = $(exec_prefix)/bin
16+
17+
PKGBASE := github.com/openxt/openxt-go
18+
PKGS := argo db ioctl
19+
CMDS := argo-nc dbdcmd dbus-send
20+
VERSION := 0.1.0
21+
22+
# FIPS is not available until Go 1.24
23+
#FIPS = GOFIPS140=v1.0.0
24+
25+
ifeq (1,${STATIC})
26+
ENV = CGO_ENABLED=0 GOOS=linux ${FIPS}
27+
FLAGS = -a -ldflags '-s -w -extldflags "-static"'
28+
else
29+
ENV = ${FIPS}
30+
FLAGS = -ldflags="-s -w"
31+
endif
32+
33+
all: ${CMDS}
1034

1135
clean:
12-
$(GOCLEAN)
13-
rm -f argo-nc
36+
@$(GOCLEAN)
37+
rm -rf $(GOBIN)
38+
39+
install: all
40+
@- $(foreach CMD, $(CMDS), \
41+
install -Dpm 0755 $(GOBIN)/$(CMD) $(DESTDIR)$(bindir)/$(CMD); \
42+
)
43+
44+
dep:
45+
$(GOMOD) download
46+
47+
vet:
48+
@- $(foreach PKG, $(PKGS), \
49+
$(GOVET) $(PKGBASE)/$(PKG); \
50+
)
51+
@- $(foreach CMD, $(CMDS), \
52+
$(GOVET) $(PKGBASE)/cmd/$(CMD); \
53+
)
54+
55+
gobin:
56+
[ -e "$(GOBIN)" ] || mkdir $(GOBIN)
1457

15-
build-all-static: build-argo-nc-static
58+
pkgsite: gobin
59+
GOBIN=$(GOBIN) $(GOINSTALL) golang.org/x/pkgsite/cmd/pkgsite@latest
1660

17-
build-argo-nc-static:
18-
CGO_ENABLED=0 GOOS=linux $(GOBUILD) $(STATIC_FLAGS) github.com/openxt/openxt-go/cmd/argo-nc
1961

20-
build-dbus-send-static:
21-
CGO_ENABLED=0 GOOS=linux $(GOBUILD) $(STATIC_FLAGS) github.com/openxt/openxt-go/cmd/dbus-send
62+
${CMDS}: gobin dep
63+
$(ENV) $(GOBUILD) -o $(GOBIN)/$@ $(FLAGS) $(PKGBASE)/cmd/$@
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
// +build libargo
22

3+
// SPDX-License-Identifier: BSD-3-Clause
34
//
4-
// Copyright 2020 Apertus Soutions, LLC
5-
//
6-
// Use of this source code is governed by a BSD-style
7-
// license that can be found in the LICENSE file
5+
// Copyright 2026 Apertus Soutions, LLC
86
//
97

108
package argo
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
// +build !libargo
22

3+
// SPDX-License-Identifier: BSD-3-Clause
34
//
4-
// Copyright 2020 Apertus Soutions, LLC
5-
//
6-
// Use of this source code is governed by a BSD-style
7-
// license that can be found in the LICENSE file
5+
// Copyright 2026 Apertus Soutions, LLC
86
//
97

108
package argo
@@ -17,6 +15,8 @@ import (
1715
"os"
1816
"syscall"
1917
"unsafe"
18+
19+
"github.com/openxt/openxt-go/ioctl"
2020
)
2121

2222
const (
@@ -33,18 +33,18 @@ const (
3333
)
3434

3535
var (
36-
argoIocSetRingSize = iow(typArgo, 1, u32Size)
37-
argoIocBind = iow(typArgo, 2, argoRingIdSize)
38-
argoIocGetSockName = iow(typArgo, 3, argoRingIdSize)
39-
argoIocGetPeerName = iow(typArgo, 4, xenArgoAddrSize)
40-
argoIocConnect = iow(typArgo, 5, xenArgoAddrSize)
41-
argoIocGetConnectErr = iow(typArgo, 6, intSize)
42-
argoIocListen = iow(typArgo, 7, u32Size)
43-
argoIocAccept = iow(typArgo, 8, xenArgoAddrSize)
44-
argoIocGetSockType = iow(typArgo, 11, intSize)
45-
argoIocViptablesAdd = iow(typArgo, 12, vIpTablesRulePos)
46-
argoIocViptablesDel = iow(typArgo, 13, vIpTablesRulePos)
47-
argoIocViptablesList = iow(typArgo, 14, u32Size)
36+
argoIocSetRingSize = ioctl.Iow(typArgo, 1, u32Size)
37+
argoIocBind = ioctl.Iow(typArgo, 2, argoRingIdSize)
38+
argoIocGetSockName = ioctl.Iow(typArgo, 3, argoRingIdSize)
39+
argoIocGetPeerName = ioctl.Iow(typArgo, 4, xenArgoAddrSize)
40+
argoIocConnect = ioctl.Iow(typArgo, 5, xenArgoAddrSize)
41+
argoIocGetConnectErr = ioctl.Iow(typArgo, 6, intSize)
42+
argoIocListen = ioctl.Iow(typArgo, 7, u32Size)
43+
argoIocAccept = ioctl.Iow(typArgo, 8, xenArgoAddrSize)
44+
argoIocGetSockType = ioctl.Iow(typArgo, 11, intSize)
45+
argoIocViptablesAdd = ioctl.Iow(typArgo, 12, vIpTablesRulePos)
46+
argoIocViptablesDel = ioctl.Iow(typArgo, 13, vIpTablesRulePos)
47+
argoIocViptablesList = ioctl.Iow(typArgo, 14, u32Size)
4848
)
4949

5050
func addrFromC(r io.Reader, a *Addr) error {

pkg/argo/argo.go renamed to argo/argo.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//
2-
// Copyright 2020 Apertus Soutions, LLC
3-
//
4-
// Use of this source code is governed by a BSD-style
5-
// license that can be found in the LICENSE file
3+
// Copyright 2026 Apertus Soutions, LLC
64
//
75

86
// Package argo provides a Go interface for interacting with the Argo character
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//
2-
// Copyright 2020 Apertus Soutions, LLC
3-
//
4-
// Use of this source code is governed by a BSD-style
5-
// license that can be found in the LICENSE file
3+
// Copyright 2026 Apertus Soutions, LLC
64
//
75

86
package dbus
@@ -14,7 +12,7 @@ import (
1412
"strings"
1513
"syscall"
1614

17-
"github.com/openxt/openxt-go/pkg/argo"
15+
"github.com/openxt/openxt-go/argo"
1816
godbus "github.com/godbus/dbus/v5"
1917
)
2018

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//
2-
// Copyright 2020 Apertus Soutions, LLC
3-
//
4-
// Use of this source code is governed by a BSD-style
5-
// license that can be found in the LICENSE file
3+
// Copyright 2026 Apertus Soutions, LLC
64
//
75

86
package argo

‎cmd/argo-nc/main.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//
2-
// Copyright 2020 Apertus Soutions, LLC
3+
// Copyright 2026 Apertus Soutions, LLC
34
//
45
// Use of this source code is governed by a BSD-style
56
// license that can be found in the LICENSE file
@@ -14,7 +15,7 @@ import (
1415
"syscall"
1516

1617
flag "github.com/spf13/pflag"
17-
"github.com/openxt/openxt-go/pkg/argo"
18+
"github.com/openxt/openxt-go/argo"
1819
)
1920

2021
var (

‎cmd/dbdcmd/main.go‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//
2-
// Copyright 2015 Apertus Soutions, LLC
3-
//
4-
// Use of this source code is governed by a BSD-style
5-
// license that can be found in the LICENSE file
3+
// Copyright 2026 Apertus Soutions, LLC
64
//
75

86
package main
@@ -11,7 +9,7 @@ import (
119
"fmt"
1210
"os"
1311

14-
"github.com/openxt/openxt-go/pkg/dbd"
12+
"github.com/openxt/openxt-go/db"
1513
)
1614

1715
func die(format string, a ...interface{}) {

‎cmd/dbus-send/main.go‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
12
//
2-
// Copyright 2020 Apertus Soutions, LLC
3-
//
4-
// Use of this source code is governed by a BSD-style
5-
// license that can be found in the LICENSE file
3+
// Copyright 2026 Apertus Soutions, LLC
64
//
75

86
package main
@@ -16,7 +14,7 @@ import (
1614
"strings"
1715

1816
flag "github.com/spf13/pflag"
19-
"github.com/openxt/openxt-go/pkg/argo/dbus"
17+
"github.com/openxt/openxt-go/argo/dbus"
2018
godbus "github.com/godbus/dbus/v5"
2119
)
2220

0 commit comments

Comments
 (0)