-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
executable file
·101 lines (80 loc) · 3.81 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
100
101
define DOCKER_BUILD_TOOL
docker buildx build --file Dockerfile-$(1) --platform linux/amd64,linux/arm64 --push -t kittymac/flynn-$(1) .
# Getting plugin for $(1)
docker pull kittymac/flynn-$(1):latest
mkdir -p ./dist/FlynnPluginTool-$(1).artifactbundle/FlynnPluginTool-arm64/bin/
mkdir -p ./dist/FlynnPluginTool-$(1).artifactbundle/FlynnPluginTool-amd64/bin/
mkdir -p ./dist/FlynnPluginTool-$(1).artifactbundle/FlynnPluginTool-macos/bin/
docker run --platform linux/arm64 --rm -v $(DIST):/outTemp kittymac/flynn-$(1) /bin/bash -lc 'cp FlynnPluginTool /outTemp/FlynnPluginTool-$(1).artifactbundle/FlynnPluginTool-arm64/bin/FlynnPluginTool'
docker run --platform linux/amd64 --rm -v $(DIST):/outTemp kittymac/flynn-$(1) /bin/bash -lc 'cp FlynnPluginTool /outTemp/FlynnPluginTool-$(1).artifactbundle/FlynnPluginTool-amd64/bin/FlynnPluginTool'
cp ./dist/FlynnPluginTool ./dist/FlynnPluginTool-$(1).artifactbundle/FlynnPluginTool-macos/bin/FlynnPluginTool
rm -f ./dist/FlynnPluginTool-$(1).zip
cd ./dist && zip -r ./FlynnPluginTool-$(1).zip ./FlynnPluginTool-$(1).artifactbundle
endef
DIST:=$(shell cd dist && pwd)
SWIFT_BUILD_FLAGS=--configuration release
build-library:
swift build -Xswiftc -enable-library-evolution -v $(SWIFT_BUILD_FLAGS)
build:
swift build --triple arm64-apple-macosx $(SWIFT_BUILD_FLAGS)
swift build --triple x86_64-apple-macosx $(SWIFT_BUILD_FLAGS)
-rm .build/FlynnPluginTool
lipo -create -output .build/FlynnPluginTool .build/arm64-apple-macosx/release/FlynnPluginTool .build/x86_64-apple-macosx/release/FlynnPluginTool
cp .build/FlynnPluginTool ./dist/FlynnPluginTool
build-windows:
# note: you probably don't have make on windows, so you need to run these manually
Stop-Process -Name "FlynnPackageTests.xctest"
rm -Recurse -Force .build
swift test
swift build --configuration release
cp .build/release/FlynnPluginTool.exe ./dist/FlynnPluginTool-windows-592.artifactbundle/FlynnPluginTool-amd64/bin/FlynnPluginTool.exe
rm ./dist/FlynnPluginTool-windows-592.zip
Compress-Archive -Path ./dist/FlynnPluginTool-windows-592.artifactbundle -DestinationPath ./dist/FlynnPluginTool-windows-592.zip
clean:
rm -rf .build
.PHONY: clean-repo
clean-repo:
rm -rf /tmp/clean-repo/
mkdir -p /tmp/clean-repo/
cd /tmp/clean-repo/ && git clone https://github.com/KittyMac/flynn.git/
cd /tmp/clean-repo/flynn && cp -r dist ../dist.tmp && cp .git/config ../config
cd /tmp/clean-repo/flynn && git filter-repo --invert-paths --path dist
cd /tmp/clean-repo/flynn && mv ../dist.tmp dist && mv ../config .git/config
cd /tmp/clean-repo/flynn && git add dist
cd /tmp/clean-repo/flynn && git commit -a -m "clean-repo"
open /tmp/clean-repo/flynn
# clean complete; manual push required
# git push origin --force --all
# git push origin --force --tags
test:
swift test -v
update:
swift package update
profile: clean
mkdir -p /tmp/flynn.stats
swift build \
--configuration release \
-Xswiftc -stats-output-dir \
-Xswiftc /tmp/flynn.stats \
-Xswiftc -trace-stats-events \
-Xswiftc -driver-time-compilation \
-Xswiftc -debug-time-function-bodies
release: build docker focal-571 fedora38-573 focal-580 focal-592
focal-571:
@$(call DOCKER_BUILD_TOOL,focal-571)
focal-580:
@$(call DOCKER_BUILD_TOOL,focal-580)
focal-592:
@$(call DOCKER_BUILD_TOOL,focal-592)
fedora38-573:
@$(call DOCKER_BUILD_TOOL,fedora38-573)
docker:
-DOCKER_HOST=ssh://[email protected] docker buildx create --name cluster_builder203 --platform linux/amd64
-docker buildx create --name cluster_builder203 --platform linux/arm64 --append
-docker buildx use cluster_builder203
-docker buildx inspect --bootstrap
-docker login
docker-shell:
docker buildx build --file Dockerfile-fedora --platform linux/amd64,linux/arm64 --push -t kittymac/flynn-fedora .
docker pull kittymac/flynn-fedora
docker run --rm -it --entrypoint bash kittymac/flynn-fedora