-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·99 lines (75 loc) · 2.26 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
PACKAGE_NAMES := $(shell ./scripts/names.rb)
PACKAGE_FILES := $(shell ./scripts/files.rb)
BUILD_PACKAGES := $(addprefix build-,$(PACKAGE_NAMES))
CHECK_PACKAGES := $(addprefix check-,$(PACKAGE_NAMES))
UPLOAD_PACKAGES := $(addprefix upload-,$(PACKAGE_NAMES))
DOCKER_CMD = docker run \
--rm -t -i \
-e LANG=en_US.UTF-8 \
-e LANGUAGE=en_US.UTF-8 \
-e LC_ALL=en_US.UTF-8 \
-e AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY \
-v $$(pwd):/opt/build \
-v $$(pwd)/.octoauth.yml:/home/build/.octoauth.yml \
-v ~/.gnupg:/home/build/.gnupg \
ghcr.io/amylum/build:latest
S3REPO ?= s3repo
BUILD = source ./makepkg.conf && $(S3REPO) build
UPLOAD = $(S3REPO) upload
NAMCAP ?= namcap
.PHONY : default clean prune $dd(BUILD_PACKAGES) build-all $(UPLOAD_PACKAGES) upload-all $(PACKAGE_NAMES) manual docker-build docker-upload docker-build-all docker-upload-all
##
## Misc. targets
##
# Defaults to building all packages with Docker
default: docker-build
# Clean any package cruft
clean:
find . -mindepth 2 -maxdepth 2 \
! -name PKGBUILD \
! -name '*.install' \
! -path './.git/*' \
! -path './templates/*' \
! -path './scripts/*' \
-print -exec rm -r {} \;
# Prune package files from the S3 bucket that are no longer in the package DB
prune:
$(S3REPO) prune
# Launch the docker container with a bash shell
manual:
$(DOCKER_CMD) bash
# Build, check, and upload an individual package
$(PACKAGE_NAMES):
$(MAKE) build-$@ check-$@ upload-$@
##
## Build packages from PKGBUILDs
## Supports individual packages, all, and building in a docker container
##
$(PACKAGE_FILES):
$(BUILD) $(shell ./scripts/names.rb $@)
$(BUILD_PACKAGES):
$(MAKE) $(shell ./scripts/files.rb $(subst build-,,$@))
build-all: $(PACKAGE_FILES)
docker-build:
$(DOCKER_CMD) make build-all
##
## Check packages with namcap
## Supports individual packages, all, and checking in a docker container
##
$(CHECK_PACKAGES):
$(MAKE) $(subst check-,build-,$@)
$(NAMCAP) $@/PKGBUILD $@/*.pkg.tar.xz
check-all: $(CHECK_PACKAGES)
docker-check:
$(DOCKER_CMD) make check-all
##
## Upload packages to S3
## Supports individual packages, all, and uploading from a docker container
##
$(UPLOAD_PACKAGES):
$(UPLOAD) $(subst upload-,,$@)
upload-all: build-all
$(UPLOAD) $(PACKAGE_NAMES)
docker-upload:
$(DOCKER_CMD) make upload-all