Skip to content

Commit 23e0ccb

Browse files
authored
Merge pull request #68 from uoregon-libraries/feature/check-c
Verify CGo is available before compiling RAIS
2 parents bc54838 + d2057fa commit 23e0ccb

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ MakefileDir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
66
BUILD := $(shell git describe --tags)
77

88
# Default target builds binaries
9-
all: binaries
9+
all: cgo binaries
1010

1111
# Security check
1212
.PHONY: audit
1313
audit:
1414
go tool govulncheck ./src/...
1515

16+
.PHONY: cgo
17+
cgo:
18+
./scripts/can_cgo.sh
19+
1620
# Generated code
1721
generate: src/transform/rotation.go
1822

scripts/can_cgo.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
if [[ $(go env CGO_ENABLED) != '1' ]]; then
4+
echo "Your system cannot build RAIS. It appears that there may not be a C compiler,"
5+
echo "which is required for the openjpeg bindings. Install gcc, clang, or similar"
6+
echo "and try again."
7+
8+
exit 1
9+
fi
10+
11+
exit 0

0 commit comments

Comments
 (0)