-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
139 lines (112 loc) · 3.63 KB
/
Makefile
File metadata and controls
139 lines (112 loc) · 3.63 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
# Makefile for Epilog Zing macOS Printer Driver
#
# Builds universal binaries and creates installer package
PRODUCT_NAME = EpilogDriver
VERSION = 1.0.0
BUILD_DIR = .build/apple/Products/Release
STAGING_DIR = .build/staging
PKG_DIR = .build/pkg
# Installation paths
FILTER_DIR = /Library/Printers/Epilog/Filters
PPD_DIR = /Library/Printers/PPDs/Contents/Resources
# Executables
FILTER = rastertoepiloz
.PHONY: all build release install uninstall clean package staging
all: build
# Build for debugging
build:
swift build
# Build universal release binaries (arm64 + x86_64)
release:
swift build -c release --arch arm64 --arch x86_64
# Create staging directory with all files
staging: release
@echo "Creating staging directory..."
rm -rf $(STAGING_DIR)
mkdir -p $(STAGING_DIR)$(FILTER_DIR)
mkdir -p $(STAGING_DIR)$(PPD_DIR)
# Copy filter executable
cp $(BUILD_DIR)/$(FILTER) $(STAGING_DIR)$(FILTER_DIR)/
# Copy PPD files
cp PPD/*.ppd $(STAGING_DIR)$(PPD_DIR)/
# Set permissions
chmod 755 $(STAGING_DIR)$(FILTER_DIR)/$(FILTER)
chmod 644 $(STAGING_DIR)$(PPD_DIR)/*.ppd
@echo "Staging complete."
# Build installer package
package: staging
@echo "Building installer package..."
rm -rf $(PKG_DIR)
mkdir -p $(PKG_DIR)
# Create component package
pkgbuild \
--root $(STAGING_DIR) \
--identifier com.epilog.driver \
--version $(VERSION) \
--scripts Installer \
$(PKG_DIR)/$(PRODUCT_NAME)-$(VERSION).pkg
@echo "Package created: $(PKG_DIR)/$(PRODUCT_NAME)-$(VERSION).pkg"
# Build signed installer (requires Developer ID)
package-signed: staging
@echo "Building signed installer package..."
rm -rf $(PKG_DIR)
mkdir -p $(PKG_DIR)
pkgbuild \
--root $(STAGING_DIR) \
--identifier com.epilog.driver \
--version $(VERSION) \
--scripts Installer \
--sign "Developer ID Installer" \
$(PKG_DIR)/$(PRODUCT_NAME)-$(VERSION).pkg
@echo "Signed package created: $(PKG_DIR)/$(PRODUCT_NAME)-$(VERSION).pkg"
# Install directly (for development)
install: release
@echo "Installing Epilog driver..."
sudo mkdir -p $(FILTER_DIR)
sudo mkdir -p $(PPD_DIR)
sudo cp $(BUILD_DIR)/$(FILTER) $(FILTER_DIR)/
sudo cp PPD/*.ppd $(PPD_DIR)/
sudo chmod 755 $(FILTER_DIR)/$(FILTER)
sudo chmod 644 $(PPD_DIR)/EpilogZing*.ppd
sudo chown root:wheel $(FILTER_DIR)/$(FILTER)
sudo chown root:wheel $(PPD_DIR)/EpilogZing*.ppd
@echo "Installation complete."
@echo ""
@echo "To add the printer:"
@echo " 1. System Preferences > Printers & Scanners > + > IP tab"
@echo " 2. Address: 192.168.3.4 (or your laser's IP)"
@echo " 3. Protocol: Line Printer Daemon - LPD"
@echo " 4. Use: Select 'Epilog Zing 16' or 'Epilog Zing 24'"
@echo ""
@echo "Or via command line:"
@echo " lpadmin -p EpilogZing -E -v lpd://192.168.3.4 -P $(PPD_DIR)/EpilogZing16.ppd"
# Uninstall
uninstall:
@echo "Uninstalling Epilog driver..."
sudo rm -f $(FILTER_DIR)/$(FILTER)
sudo rm -f $(PPD_DIR)/EpilogZing16.ppd
sudo rm -f $(PPD_DIR)/EpilogZing24.ppd
-sudo rmdir $(FILTER_DIR) 2>/dev/null || true
-sudo rmdir /Library/Printers/Epilog 2>/dev/null || true
@echo "Uninstallation complete."
# Clean build artifacts
clean:
swift package clean
rm -rf $(STAGING_DIR)
rm -rf $(PKG_DIR)
# Run tests
test:
swift test
# Show help
help:
@echo "Epilog Zing macOS Printer Driver"
@echo ""
@echo "Targets:"
@echo " build - Build for debugging"
@echo " release - Build universal release binaries"
@echo " install - Install driver to system (requires sudo)"
@echo " uninstall - Remove driver from system (requires sudo)"
@echo " package - Create installer .pkg"
@echo " clean - Remove build artifacts"
@echo " test - Run unit tests"
@echo " help - Show this help"