commit a8d38d25283e14545c25e84a19fdea166ac13cd2
parent a718812627e071d7578f9e96069992c1486de29c
Author: Sean Enck <sean@ttypty.com>
Date: Thu, 14 Jul 2022 18:32:06 -0400
switch to make
Diffstat:
4 files changed, 28 insertions(+), 57 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
@@ -4,24 +4,15 @@ on: [push, pull_request]
jobs:
build:
- strategy:
- matrix:
- go-version: [1.16.x]
- os: [ubuntu-latest]
- runs-on: ${{ matrix.os }}
+ runs-on: ubuntu-latest
+ container:
+ image: alpine:latest
steps:
- - uses: actions/setup-go@v2
- with:
- go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v2
- name: "deps"
- run: sudo apt-get install -y meson ninja-build
- - name: "meson"
- run: meson setup build
- - name: "ninja"
- working-directory: build
- run: ninja
- - name: "test"
- working-directory: build
- run: ninja test
+ run: apk add go make
+ - name: "build"
+ run: make
+ - name: "check"
+ run: make check
diff --git a/Makefile b/Makefile
@@ -0,0 +1,18 @@
+VERSION := development
+DESTDIR :=
+TARGETS := $(shell ls cmd/)
+SOURCE := $(shell find cmd/ -type f) $(shell find internal/ -type f)
+LIBEXEC := $(DESTDIR)libexec/lockbox/
+BUILD := bin/
+
+all: $(TARGETS)
+
+$(TARGETS): $(SOURCE)
+ mkdir -p $(BUILD)
+ go build -ldflags '-X main.version=$(VERSION() -X main.libExec=$(LIBEXEC)' -trimpath -buildmode=pie -mod=readonly -modcacherw -o $(BUILD)$@ cmd/$@/main.go
+
+check: $(TARGETS)
+ cd tests && ./run.sh ../$(BUILD)
+
+clean:
+ rm -rf $(BUILD)
diff --git a/README.md b/README.md
@@ -93,13 +93,9 @@ To manage the `.lb` files in a git repository and see _actual_ text diffs and th
## build
-Requires `meson` and `ninja`
+Requires `make`
Clone this repository and:
```
-meson setup build
-```
-
-```
-cd build && ninja
+make
```
diff --git a/meson.build b/meson.build
@@ -1,34 +0,0 @@
-project('lockbox', version: 'development')
-golang = find_program('go')
-proj_exec = join_paths(get_option('libexecdir'), meson.project_name())
-lib_exec = join_paths(get_option('prefix'), proj_exec)
-vers_flag = '-X main.version=' + meson.project_version() + ' -X main.libExec=' + lib_exec
-flags = ['-ldflags'] + [vers_flag] + ['-trimpath', '-buildmode=pie', '-mod=readonly', '-modcacherw']
-
-in_files = run_command('find', join_paths(meson.current_source_dir(), 'internal'), '-type', 'f', '-name', '*.go', check: true).stdout().strip().split()
-in_files += 'go.mod'
-in_files += 'go.sum'
-
-progs = run_command('ls', join_paths(meson.current_source_dir(), 'cmd'), check: true).stdout().strip().split()
-
-foreach p : progs
- cmd_file = join_paths(meson.current_source_dir(), 'cmd', p, 'main.go')
- target_files = in_files
- target_files += cmd_file
- dest_dir = proj_exec
- if p == 'lb'
- dest_dir = 'bin'
- endif
- p = custom_target(
- p,
- output: p,
- build_by_default: true,
- input: target_files,
- command: [ golang, 'build', flags, '-o','@OUTPUT@', cmd_file],
- )
-endforeach
-test_dir = join_paths(meson.current_source_dir(), 'tests')
-test('lb checks',
- find_program('bash'),
- workdir: test_dir,
- args: [join_paths(test_dir, 'run.sh'), meson.current_build_dir()])