-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
245 lines (227 loc) ยท 9.46 KB
/
Makefile
File metadata and controls
245 lines (227 loc) ยท 9.46 KB
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# DISABLE TITLEBARS Makefile
# Simple build automation for DISABLE TITLEBARS Ammonia tweak
# Variables
PROJECT_NAME = Yeetbar
SWIFT_SOURCE = Sources/DisableTitlebars/DisableTitlebars.swift
OBJC_SOURCE = Sources/DisableTitlebars/YeetbarLoader.m
BUILD_DIR = .build
DYLIB_PATH = $(BUILD_DIR)/Yeetbar.dylib
INSTALL_PATH = /var/ammonia/core/tweaks
# Color definitions for output
GREEN := \033[32m
YELLOW := \033[33m
BLUE := \033[34m
RED := \033[31m
CYAN := \033[36m
BOLD := \033[1m
RESET := \033[0m
# Default target
.PHONY: all
all: build
# Build the dylib from single Swift file
.PHONY: build
build:
@echo -e "$(CYAN)Building $(PROJECT_NAME) universal dylib from single Swift file...$(RESET)"
@mkdir -p $(BUILD_DIR)
@echo -e "$(YELLOW)Building for arm64...$(RESET)"
swiftc -emit-library -o $(BUILD_DIR)/$(PROJECT_NAME)_arm64.dylib $(SWIFT_SOURCE) $(OBJC_SOURCE) \
-target arm64-apple-macos11.0 \
-Xlinker -install_name -Xlinker @executable_path/$(PROJECT_NAME).dylib \
-framework Foundation -framework AppKit -framework Cocoa
@echo -e "$(YELLOW)Building for arm64e...$(RESET)"
swiftc -emit-library -o $(BUILD_DIR)/$(PROJECT_NAME)_arm64e.dylib $(SWIFT_SOURCE) $(OBJC_SOURCE) \
-target arm64e-apple-macos11.0 \
-Xlinker -install_name -Xlinker @executable_path/$(PROJECT_NAME).dylib \
-framework Foundation -framework AppKit -framework Cocoa
@echo -e "$(YELLOW)Building for x86_64...$(RESET)"
swiftc -emit-library -o $(BUILD_DIR)/$(PROJECT_NAME)_x86_64.dylib $(SWIFT_SOURCE) $(OBJC_SOURCE) \
-target x86_64-apple-macos11.0 \
-Xlinker -install_name -Xlinker @executable_path/$(PROJECT_NAME).dylib \
-framework Foundation -framework AppKit -framework Cocoa
@echo -e "$(BLUE)Creating universal FAT binary...$(RESET)"
lipo -create \
$(BUILD_DIR)/Yeetbar_arm64.dylib \
$(BUILD_DIR)/Yeetbar_arm64e.dylib \
$(BUILD_DIR)/Yeetbar_x86_64.dylib \
-output $(DYLIB_PATH)
@echo -e "$(GREEN)Universal dylib created successfully!$(RESET)"
@echo -e "$(GREEN)Built: $(DYLIB_PATH)$(RESET)"
# Test injection with CrystalFetch
.PHONY: test
test: build
@echo -e "$(CYAN)Testing $(PROJECT_NAME) injection with CrystalFetch...$(RESET)"
@if [ ! -f "$(DYLIB_PATH)" ]; then echo -e "$(RED)Error: Dylib not found. Run 'make build' first.$(RESET)"; exit 1; fi
@echo -e "$(YELLOW)Launching CrystalFetch with dylib injection...$(RESET)"
@echo -e "$(BLUE)Check Console.app for 'Yeetbar' logs to verify injection$(RESET)"
DYLD_INSERT_LIBRARIES="$(PWD)/$(DYLIB_PATH)" open -a CrystalFetch
@echo -e "$(GREEN)CrystalFetch launched! Check Console.app for 'Yeetbar' logs.$(RESET)"
# Install the tweak to Ammonia system
.PHONY: install
install: build
@echo -e "$(CYAN)Installing $(PROJECT_NAME) to $(INSTALL_PATH)...$(RESET)"
sudo mkdir -p $(INSTALL_PATH)
sudo rm -f $(INSTALL_PATH)/Yeetbar.dylib $(INSTALL_PATH)/Yeetbar.dylib.blacklist
sudo cp $(DYLIB_PATH) $(INSTALL_PATH)/Yeetbar.dylib
@if [ -f "Yeetbar.dylib.blacklist" ]; then \
sudo cp Yeetbar.dylib.blacklist $(INSTALL_PATH)/Yeetbar.dylib.blacklist; \
fi
sudo chown root:wheel $(INSTALL_PATH)/Yeetbar.dylib
sudo chmod 755 $(INSTALL_PATH)/Yeetbar.dylib
@if [ -f "$(INSTALL_PATH)/Yeetbar.dylib.blacklist" ]; then \
sudo chown root:wheel $(INSTALL_PATH)/Yeetbar.dylib.blacklist; \
sudo chmod 644 $(INSTALL_PATH)/Yeetbar.dylib.blacklist; \
fi
@echo -e "$(GREEN)$(PROJECT_NAME) dylib installed successfully!$(RESET)"
@echo -e "$(YELLOW)Note: Restart applications to see the effect$(RESET)"
# Test with TextEdit
.PHONY: textedit
textedit:
@echo "๐ Testing Yeetbar with TextEdit..."
@pkill -f TextEdit || true
@sleep 1
@DYLD_INSERT_LIBRARIES=/var/ammonia/core/tweaks/Yeetbar.dylib open -a TextEdit
@sleep 3
@osascript -e 'tell application "TextEdit"' \
-e 'activate' \
-e 'make new document' \
-e 'set text of document 1 to "This is a test document for toolbar preservation.\n\nThis text should help test formatting options."' \
-e 'end tell'
@echo "๐ TextEdit launched with Yeetbar and test document created. Check Console.app for logs."
# Test with Finder
.PHONY: finder
finder:
@echo "๐ Testing Yeetbar with Finder..."
@pkill -f Finder || true
@sleep 1
@DYLD_INSERT_LIBRARIES=/var/ammonia/core/tweaks/Yeetbar.dylib open -a Finder
@sleep 3
@osascript -e 'tell application "Finder"' \
-e 'activate' \
-e 'open home' \
-e 'end tell'
@echo "๐ Finder launched with Yeetbar and opened home directory. Check Console.app for logs."
# Test with Chess
.PHONY: chess
chess:
@echo "โ๏ธ Testing Yeetbar with Chess..."
@pkill -f Chess || true
@sleep 1
@DYLD_INSERT_LIBRARIES=/var/ammonia/core/tweaks/Yeetbar.dylib open -a Chess
@sleep 3
@osascript -e 'tell application "Chess"' \
-e 'activate' \
-e 'end tell'
@echo "โ๏ธ Chess launched with Yeetbar. Check Console.app for logs."
# Test with Calculator
.PHONY: calculator
calculator:
@echo "๐งฎ Testing Yeetbar with Calculator..."
@pkill -f Calculator || true
@sleep 1
@DYLD_INSERT_LIBRARIES=/var/ammonia/core/tweaks/Yeetbar.dylib open -a Calculator
@sleep 3
@osascript -e 'tell application "Calculator"' \
-e 'activate' \
-e 'end tell'
@echo "๐งฎ Calculator launched with Yeetbar. Check Console.app for logs."
# Test with Grapher
.PHONY: graph
graph:
@echo "๐ Testing Yeetbar with Grapher..."
@pkill -f Grapher || true
@sleep 1
@DYLD_INSERT_LIBRARIES=/var/ammonia/core/tweaks/Yeetbar.dylib open -a Grapher
@sleep 3
@osascript -e 'tell application "Grapher"' \
-e 'activate' \
-e 'end tell'
@echo "๐ Grapher launched with Yeetbar. Check Console.app for logs."
# Test with CrystalFetch
.PHONY: crystalfetch
crystalfetch:
@echo "๐ Testing Yeetbar with CrystalFetch..."
@pkill -f CrystalFetch || true
@sleep 1
@DYLD_INSERT_LIBRARIES=/var/ammonia/core/tweaks/Yeetbar.dylib open -a CrystalFetch
@sleep 3
@osascript -e 'tell application "CrystalFetch"' \
-e 'activate' \
-e 'end tell'
@echo "๐ CrystalFetch launched with Yeetbar. Check Console.app for logs."
# Test with LibreOffice
.PHONY: libreoffice
libreoffice:
@echo "๐ Testing Yeetbar with LibreOffice..."
@pkill -f LibreOffice || true
@sleep 1
@DYLD_INSERT_LIBRARIES=/var/ammonia/core/tweaks/Yeetbar.dylib open -a LibreOffice
@sleep 3
@osascript -e 'tell application "LibreOffice"' \
-e 'activate' \
-e 'end tell'
@echo "๐ LibreOffice launched with Yeetbar. Check Console.app for logs."
# Uninstall the tweak from system
.PHONY: uninstall remove
uninstall remove:
@echo -e "$(CYAN)Uninstalling $(PROJECT_NAME) from system...$(RESET)"
sudo rm -f $(INSTALL_PATH)/Yeetbar.dylib
sudo rm -f $(INSTALL_PATH)/Yeetbar.dylib.blacklist
@echo -e "$(GREEN)$(PROJECT_NAME) uninstalled successfully!$(RESET)"
# Clean build artifacts
.PHONY: clean
clean:
@echo -e "$(CYAN)Cleaning build artifacts...$(RESET)"
rm -rf $(BUILD_DIR)
@echo -e "$(GREEN)Clean complete!$(RESET)"
# Show file information
.PHONY: info
info: build
@echo -e "$(CYAN)$(PROJECT_NAME) Dylib Information:$(RESET)"
@if [ -f "$(DYLIB_PATH)" ]; then \
echo -e "$(GREEN)File: $(DYLIB_PATH)$(RESET)"; \
echo -e "$(YELLOW)Size: $$(du -h $(DYLIB_PATH) | cut -f1)$(RESET)"; \
echo -e "$(BLUE)Architectures:$(RESET)"; \
lipo -info $(DYLIB_PATH); \
else \
echo -e "$(RED)Dylib not found. Run 'make build' first.$(RESET)"; \
fi
# Show Console.app logs filtered for Yeetbar entries
.PHONY: logs
logs:
@echo "Filtering Console.app logs for 'Yeetbar' entries..."
@echo "Checking system logs..."
tail -f /var/log/system.log 2>/dev/null | grep -i yeetbar || echo "No system.log found, trying alternative..."
@echo "Checking Console logs with simpler filter..."
log show --last 5m 2>/dev/null | grep -i yeetbar || echo "No Yeetbar entries found in recent logs"
@echo "Checking for any DisableTitlebars related logs..."
log show --last 5m 2>/dev/null | grep -i "DisableTitlebars\|dylib\|inject" | head -10 || echo "No related logs found"
# Help
.PHONY: help
help:
@echo -e "$(BOLD)DISABLE TITLEBARS Build System$(RESET)"
@echo ""
@echo -e "$(CYAN)Available targets:$(RESET)"
@echo -e " $(GREEN)build$(RESET) - Build the dylib from single Swift file"
@echo -e " $(GREEN)test$(RESET) - Test injection with CrystalFetch application"
@echo -e " $(GREEN)textedit$(RESET) - Test with TextEdit application"
@echo -e " $(GREEN)finder$(RESET) - Test with Finder application"
@echo -e " $(GREEN)chess$(RESET) - Test with Chess application"
@echo -e " $(GREEN)calculator$(RESET) - Test with Calculator application"
@echo -e " $(GREEN)graph$(RESET) - Test with Grapher application"
@echo -e " $(GREEN)crystalfetch$(RESET) - Test with CrystalFetch application"
@echo -e " $(GREEN)libreoffice$(RESET) - Test with LibreOffice application"
@echo -e " $(GREEN)install$(RESET) - Install tweak to Ammonia system (/var/ammonia/core/tweaks)"
@echo -e " $(GREEN)uninstall$(RESET) - Uninstall tweak from system (alias: remove)"
@echo -e " $(GREEN)logs$(RESET) - Show Console.app logs filtered for 'Yeetbar' entries"
@echo -e " $(GREEN)clean$(RESET) - Clean build artifacts"
@echo -e " $(GREEN)info$(RESET) - Show dylib information and architectures"
@echo -e " $(GREEN)help$(RESET) - Show this help message"
@echo ""
@echo -e "$(YELLOW)Usage Examples:$(RESET)"
@echo -e " make build # Build the tweak from single Swift file"
@echo -e " make test # Test with CrystalFetch application"
@echo -e " make logs # Show filtered Console.app logs"
@echo -e " make install # Install to Ammonia tweaks directory"
@echo -e " make remove # Remove from system"
@echo ""
@echo -e "$(BLUE)Search for 'Yeetbar' in Console.app to verify injection$(RESET)"