forked from raphamorim/rio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
167 lines (138 loc) · 5.62 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
.PHONY: docs
BUILD_MISC_DIR = misc
DOCS_DIR = docs
TARGET = rio
TARGET_DIR = target/release
TARGET_DIR_DEBIAN = target/debian
TARGET_DIR_OSX = $(TARGET_DIR)/osx
RELEASE_DIR = release
APP_NAME = Rio.app
APP_TEMPLATE = $(BUILD_MISC_DIR)/osx/$(APP_NAME)
APP_BINARY = $(TARGET_DIR)/$(TARGET)
APP_BINARY_DIR = $(TARGET_DIR_OSX)/$(APP_NAME)/Contents/MacOS
APP_EXTRAS_DIR = $(TARGET_DIR_OSX)/$(APP_NAME)/Contents/Resources
TERMINFO = $(BUILD_MISC_DIR)/rio.terminfo
all: install run
docs:
cd $(DOCS_DIR) && make run
run:
cargo run --release
dev:
cargo run
dev-watch:
#cargo install cargo-watch
cargo watch -- cargo run
install:
cargo fetch
build: install
RUSTFLAGS='-C link-arg=-s' cargo build --release
$(TARGET)-universal:
RUSTFLAGS='-C link-arg=-s' MACOSX_DEPLOYMENT_TARGET="10.11" cargo build --release --target=x86_64-apple-darwin
RUSTFLAGS='-C link-arg=-s' MACOSX_DEPLOYMENT_TARGET="10.11" cargo build --release --target=aarch64-apple-darwin
@lipo target/{x86_64,aarch64}-apple-darwin/release/$(TARGET) -create -output $(APP_BINARY)
app-universal: $(APP_NAME)-universal ## Create a universal Rio.app
$(APP_NAME)-%: $(TARGET)-%
@mkdir -p $(APP_BINARY_DIR)
@mkdir -p $(APP_EXTRAS_DIR)
@cp -fRp $(APP_TEMPLATE) $(TARGET_DIR_OSX)
@cp -fp $(APP_BINARY) $(APP_BINARY_DIR)
@tic -xe rio -o $(APP_EXTRAS_DIR) $(TERMINFO)
@touch -r "$(APP_BINARY)" "$(TARGET_DIR_OSX)/$(APP_NAME)"
release-macos: app-universal
@codesign --remove-signature "$(TARGET_DIR_OSX)/$(APP_NAME)"
@codesign --force --deep --sign - "$(TARGET_DIR_OSX)/$(APP_NAME)"
@echo "Created '$(APP_NAME)' in '$(TARGET_DIR_OSX)'"
mkdir -p $(RELEASE_DIR)
cp -rf ./target/release/osx/* ./release/
cd ./release && zip -r ./macos-rio.zip ./*
release-macos-local: release-macos
rm -rf /Applications/$(APP_NAME)
mv ./release/$(APP_NAME) /Applications/
version-not-found:
@echo "Rio version was not specified"
@echo " - usage: $ make release-macos-signed version=0.0.0"
release-macos-app-signed:
@make app-universal
@echo "Releasing Rio v$(version)"
@codesign --force --deep --options runtime --sign "Developer ID Application: Hugo Amorim" "$(TARGET_DIR_OSX)/$(APP_NAME)"
mkdir -p $(RELEASE_DIR) && cp -rf ./target/release/osx/* ./release/
@ditto -c -k --keepParent ./release/$(APP_NAME) ./release/Rio-v$(version).zip
@xcrun notarytool submit ./release/Rio-v$(version).zip --keychain-profile "Hugo Amorim" --wait
rm -rf ./release/$(APP_NAME)
@unzip ./release/Rio-v$(version).zip -d ./release
# e.g: make update-version old-version=0.0.13 new-version=0.0.12
update-version:
@echo "Switching from $(old-version) to $(new-version)"
find Cargo.toml -type f -exec sed -i '' 's/$(old-version)/$(new-version)/g' {} \;
find CHANGELOG.md -type f -exec sed -i '' 's/In progress/In progress\n\n- TBD\n\n## $(new-version)/g' {} \;
find $(BUILD_MISC_DIR)/windows/rio.wxs -type f -exec sed -i '' 's/$(old-version)/$(new-version)/g' {} \;
find $(APP_TEMPLATE)/Contents/Info.plist -type f -exec sed -i '' 's/$(old-version)/$(new-version)/g' {} \;
find $(DOCS_DIR)/_config.yml -type f -exec sed -i '' 's/$(old-version)/$(new-version)/g' {} \;
release-macos-dmg:
# Using https://www.npmjs.com/package/create-dmg
cd ./release && create-dmg $(APP_NAME) --dmg-title="Rio ${version}" --overwrite
# Using https://github.com/create-dmg/create-dmg
# create-dmg \
# --volname "Rio" \
# --volicon "$(APP_EXTRAS_DIR)/Rio-stable.icns" \
# --text-size 30 \
# --window-pos 200 120 \
# --window-size 800 400 \
# --icon-size 100 \
# --icon "Rio.app" 200 190 \
# --hide-extension "Rio.app" \
# --app-drop-link 600 185 \
# --skip-jenkins \
# --background "./resources/rio-colors.png" \
# ./release/Rio-v0.0.0.dmg ./release/Rio.app
# mv "./release/Rio $(version).dmg" "./release/Rio-v$(version).dmg"
release-macos-signed:
$(eval VERSION = $(shell echo $(version)))
$(if $(strip $(VERSION)),make release-macos-app-signed, make version-not-found)
bump-brew:
brew bump-cask-pr rio --version ${version}
# TODO: Move to bin path
release-x11:
RUSTFLAGS='-C link-arg=-s' cargo build --release --no-default-features --features=x11
target/release/rio
release-wayland:
RUSTFLAGS='-C link-arg=-s' cargo build --release --no-default-features --features=wayland
target/release/rio
# Debian
# cargo install cargo-deb
# To install: sudo release/debian/rio_<version>_<architecture>_<feature>.deb
# e.g: sudo release/debian/rio_0.0.13_arm64_wayland.deb
release-debian-x11:
cargo deb -p rio -- --release --no-default-features --features=x11
mkdir -p $(RELEASE_DIR)/debian/x11
mv $(TARGET_DIR_DEBIAN)/* $(RELEASE_DIR)/debian/x11/
cd $(RELEASE_DIR)/debian/x11 && rename 's/.deb/_x11.deb/g' *
release-debian-wayland:
cargo deb -p rio -- --release --no-default-features --features=wayland
mkdir -p $(RELEASE_DIR)/debian/wayland
mv $(TARGET_DIR_DEBIAN)/* $(RELEASE_DIR)/debian/wayland/
cd $(RELEASE_DIR)/debian/wayland && rename 's/.deb/_wayland.deb/g' *
# Release and Install
install-debian-x11:
cargo install cargo-deb
cargo deb -p rio --install -- --release --no-default-features --features=x11
install-debian-wayland:
cargo install cargo-deb
cargo deb -p rio --install -- --release --no-default-features --features=wayland
# cargo install cargo-wix
# https://github.com/volks73/cargo-wix
release-windows:
cargo wix -p rio
lint:
cargo fmt -- --check --color always
cargo clippy --all-targets --all-features -- -D warnings
# There is errors regarding null pointers in corcovado that needs to be fixed for Windows
test-win:
cargo fmt -- --check --color always
cargo clippy --all-targets --all-features
RUST_BACKTRACE=full cargo test --release
test:
make lint
RUST_BACKTRACE=full cargo test --release
test-renderer:
cd ./sugarloaf && make test