Skip to content

Commit dc79132

Browse files
Shift MacKernelSDK libkmod.a to universal version to set ground for i386
* Remove MARKETING_VERSION and refer CURRENT_PROJECT_VERSION to MODULE_VERSION * CI: Update github-action modules version * Fix macOS version check logic in print_version.sh * Update makefile to correctly create distribute
1 parent d0e4ee6 commit dc79132

File tree

5 files changed

+121
-66
lines changed

5 files changed

+121
-66
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,26 @@ jobs:
1717
env:
1818
JOB_TYPE: BUILD
1919
steps:
20-
- uses: actions/checkout@v2
21-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v4
2222
with:
2323
repository: acidanthera/MacKernelSDK
2424
path: MacKernelSDK
2525
- name: CI Bootstrap
2626
run: |
2727
src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/ci-bootstrap.sh) && eval "$src" || exit 1
2828
29-
- run: xcodebuild -scheme CodecCommander -derivedDataPath . -configuration Debug
30-
- run: xcodebuild -scheme CodecCommander -derivedDataPath . -configuration Release
29+
- run: xcodebuild -scheme CodecCommander -configuration Debug
30+
- run: xcodebuild -scheme CodecCommander -configuration Release
3131

3232
- name: Upload to Artifacts
33-
uses: actions/upload-artifact@v2
33+
uses: actions/upload-artifact@v4
3434
with:
3535
name: Artifacts
3636
path: Build/Products/*/*.zip
3737
- name: Upload to Release
3838
if: github.event_name == 'release'
39-
uses: svenstaro/upload-release-action@v2
39+
uses: svenstaro/upload-release-action@v4
4040
with:
4141
repo_token: ${{ secrets.GITHUB_TOKEN }}
4242
file: Build/Products/*/*.zip

CodecCommander.xcodeproj/project.pbxproj

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/* Begin PBXBuildFile section */
1010
849921901600F4FC00CCDF3B /* CodecCommander.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8499218E1600F4FC00CCDF3B /* CodecCommander.cpp */; };
1111
849921911600F4FC00CCDF3B /* CodecCommander.h in Headers */ = {isa = PBXBuildFile; fileRef = 8499218F1600F4FC00CCDF3B /* CodecCommander.h */; };
12-
AA3842732616842B006705B9 /* libkmod.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA3842722616842B006705B9 /* libkmod.a */; };
12+
AA915F2E2DF971A70090B341 /* libkmod.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA915F2D2DF971A70090B341 /* libkmod.a */; };
1313
D404F1D61A124D5E008E6BFD /* Client.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D404F1D51A124D5E008E6BFD /* Client.cpp */; };
1414
D40F6EDE1A73EC0A0064E146 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D40F6EDC1A73EBFD0064E146 /* CoreFoundation.framework */; };
1515
D42D3C081A59558C006C4C8C /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = D42D3C071A59558C006C4C8C /* main.c */; };
@@ -41,7 +41,7 @@
4141
8499218E1600F4FC00CCDF3B /* CodecCommander.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = CodecCommander.cpp; sourceTree = "<group>"; usesTabs = 1; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
4242
8499218F1600F4FC00CCDF3B /* CodecCommander.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CodecCommander.h; sourceTree = "<group>"; usesTabs = 1; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
4343
849F78D71ACFC03600389EDA /* makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = makefile; sourceTree = "<group>"; usesTabs = 1; };
44-
AA3842722616842B006705B9 /* libkmod.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libkmod.a; path = MacKernelSDK/Library/x86_64/libkmod.a; sourceTree = "<group>"; };
44+
AA915F2D2DF971A70090B341 /* libkmod.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libkmod.a; path = MacKernelSDK/Library/universal/libkmod.a; sourceTree = "<group>"; };
4545
D404F1D51A124D5E008E6BFD /* Client.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Client.cpp; sourceTree = "<group>"; };
4646
D40F6EDC1A73EBFD0064E146 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
4747
D42D3C051A59558B006C4C8C /* CodecCommanderClient */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CodecCommanderClient; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -69,7 +69,7 @@
6969
isa = PBXFrameworksBuildPhase;
7070
buildActionMask = 2147483647;
7171
files = (
72-
AA3842732616842B006705B9 /* libkmod.a in Frameworks */,
72+
AA915F2E2DF971A70090B341 /* libkmod.a in Frameworks */,
7373
);
7474
runOnlyForDeploymentPostprocessing = 0;
7575
};
@@ -112,7 +112,7 @@
112112
0C4B238014598AD20080D960 /* Frameworks */ = {
113113
isa = PBXGroup;
114114
children = (
115-
AA3842722616842B006705B9 /* libkmod.a */,
115+
AA915F2D2DF971A70090B341 /* libkmod.a */,
116116
D40F6EDC1A73EBFD0064E146 /* CoreFoundation.framework */,
117117
D42D3C0D1A595937006C4C8C /* IOKit.framework */,
118118
0AE84D9919B8306F00968A53 /* Kernel.framework */,
@@ -361,6 +361,7 @@
361361
MODULE_VERSION = 2.7.3;
362362
ONLY_ACTIVE_ARCH = YES;
363363
SDKROOT = macosx;
364+
SYMROOT = Build/Products;
364365
WRAPPER_EXTENSION = kext;
365366
};
366367
name = Debug;
@@ -405,6 +406,7 @@
405406
MACOSX_DEPLOYMENT_TARGET = 10.6;
406407
MODULE_VERSION = 2.7.3;
407408
SDKROOT = macosx;
409+
SYMROOT = Build/Products;
408410
WRAPPER_EXTENSION = kext;
409411
};
410412
name = Release;
@@ -413,17 +415,16 @@
413415
isa = XCBuildConfiguration;
414416
buildSettings = {
415417
CLANG_ENABLE_OBJC_WEAK = YES;
418+
CODE_SIGNING_ALLOWED = NO;
416419
CODE_SIGN_IDENTITY = "";
417-
CODE_SIGNING_ALLOWED = NO;
418-
CURRENT_PROJECT_VERSION = 2.7.3;
420+
CURRENT_PROJECT_VERSION = "$(MODULE_VERSION)";
419421
GCC_PRECOMPILE_PREFIX_HEADER = YES;
420422
GCC_PREFIX_HEADER = "CodecCommander/CodecCommander-Prefix.pch";
421423
INFOPLIST_FILE = "CodecCommander/CodecCommander-Info.plist";
422424
LIBRARY_SEARCH_PATHS = (
423425
"$(inherited)",
424-
"$(PROJECT_DIR)/MacKernelSDK/Library/x86_64",
426+
"$(PROJECT_DIR)/MacKernelSDK/Library/universal",
425427
);
426-
MARKETING_VERSION = 2.7.3;
427428
MODULE_NAME = org.tw.CodecCommander;
428429
MODULE_START = CodecCommander_Start;
429430
MODULE_STOP = CodecCommander_Stop;
@@ -437,17 +438,16 @@
437438
isa = XCBuildConfiguration;
438439
buildSettings = {
439440
CLANG_ENABLE_OBJC_WEAK = YES;
441+
CODE_SIGNING_ALLOWED = NO;
440442
CODE_SIGN_IDENTITY = "";
441-
CODE_SIGNING_ALLOWED = NO;
442-
CURRENT_PROJECT_VERSION = 2.7.3;
443+
CURRENT_PROJECT_VERSION = "$(MODULE_VERSION)";
443444
GCC_PRECOMPILE_PREFIX_HEADER = YES;
444445
GCC_PREFIX_HEADER = "CodecCommander/CodecCommander-Prefix.pch";
445446
INFOPLIST_FILE = "CodecCommander/CodecCommander-Info.plist";
446447
LIBRARY_SEARCH_PATHS = (
447448
"$(inherited)",
448-
"$(PROJECT_DIR)/MacKernelSDK/Library/x86_64",
449+
"$(PROJECT_DIR)/MacKernelSDK/Library/universal",
449450
);
450-
MARKETING_VERSION = 2.7.3;
451451
MODULE_NAME = org.tw.CodecCommander;
452452
MODULE_START = CodecCommander_Start;
453453
MODULE_STOP = CodecCommander_Stop;
@@ -461,8 +461,8 @@
461461
isa = XCBuildConfiguration;
462462
buildSettings = {
463463
CLANG_ENABLE_OBJC_WEAK = YES;
464+
CODE_SIGNING_ALLOWED = NO;
464465
CODE_SIGN_IDENTITY = "";
465-
CODE_SIGNING_ALLOWED = NO;
466466
MACOSX_DEPLOYMENT_TARGET = 10.6;
467467
ONLY_ACTIVE_ARCH = YES;
468468
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -473,8 +473,8 @@
473473
isa = XCBuildConfiguration;
474474
buildSettings = {
475475
CLANG_ENABLE_OBJC_WEAK = YES;
476+
CODE_SIGNING_ALLOWED = NO;
476477
CODE_SIGN_IDENTITY = "";
477-
CODE_SIGNING_ALLOWED = NO;
478478
MACOSX_DEPLOYMENT_TARGET = 10.6;
479479
PRODUCT_NAME = "$(TARGET_NAME)";
480480
};

makefile

Lines changed: 61 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,92 @@
1-
KEXT=CodecCommander.kext
2-
DIST=RehabMan-CodecCommander
3-
BUILDDIR=./build/Products
4-
OPTIONS:=$(OPTIONS) -scheme CodecCommander
1+
KEXT := CodecCommander.kext
2+
DIST := CodecCommander
3+
BUILDDIR := ./Build/Products
54

6-
VERSION_ERA=$(shell ./print_version.sh)
7-
ifeq "$(VERSION_ERA)" "10.10-"
8-
INSTDIR=/System/Library/Extensions
9-
else
10-
INSTDIR=/Library/Extensions
11-
endif
5+
VERSION_ERA := $(shell ./print_version.sh)
6+
VERSION_MODULE := $(shell ./print_module_version.sh)
127

13-
ifeq ($(findstring 32,$(BITS)),32)
14-
OPTIONS:=$(OPTIONS) -arch i386
8+
ifeq ($(VERSION_ERA),10.10-)
9+
INSTDIR := /System/Library/Extensions
1510
endif
16-
17-
ifeq ($(findstring 64,$(BITS)),64)
18-
OPTIONS:=$(OPTIONS) -arch x86_64
11+
ifeq ($(VERSION_ERA),10.11-10.15)
12+
INSTDIR := /Library/Extensions
1913
endif
2014

21-
.PHONY: all
22-
all:
23-
xcodebuild build $(OPTIONS) -configuration Debug
24-
xcodebuild build $(OPTIONS) -configuration Release
15+
ifeq ($(VERSION_ERA),10.10-)
16+
BINDIR := /usr/bin
17+
else
18+
BINDIR := /usr/local/bin
19+
endif
2520

26-
.PHONY: clean
27-
clean:
28-
xcodebuild clean $(OPTIONS) -configuration Debug
29-
xcodebuild clean $(OPTIONS) -configuration Release
21+
# on 11+ we stub out all install steps
22+
ifeq ($(VERSION_ERA),11+)
23+
.PHONY: install install_debug update_kernelcache
24+
install install_debug update_kernelcache:
25+
@echo "Install/update skipped on macOS $(shell sw_vers -productVersion)"
26+
else
27+
# only for 10.10- through 10.15:
28+
.PHONY: update_kernelcache install_debug install
3029

31-
.PHONY: update_kernelcache
3230
update_kernelcache:
3331
sudo touch /System/Library/Extensions
3432
sudo kextcache -update-volume /
3533

36-
.PHONY: install_debug
3734
install_debug:
38-
sudo cp $(BUILDDIR)/Debug/CodecCommanderClient /usr/bin/hda-verb
39-
if [ "`which tag`" != "" ]; then sudo tag -a Purple /usr/bin/hda-verb; fi
35+
if [ ! -d $(BINDIR) ]; then sudo mkdir -p $(BINDIR); fi
36+
sudo cp $(BUILDDIR)/Debug/CodecCommanderClient $(BINDIR)/hda-verb
37+
if [ "`which tag`" != "" ]; then sudo tag -a Purple $(BINDIR)/hda-verb; fi
4038
sudo rm -Rf $(INSTDIR)/$(KEXT)
4139
sudo cp -R $(BUILDDIR)/Debug/$(KEXT) $(INSTDIR)
4240
if [ "`which tag`" != "" ]; then sudo tag -a Purple $(INSTDIR)/$(KEXT); fi
43-
make update_kernelcache
41+
$(MAKE) update_kernelcache
4442

45-
.PHONY: install
4643
install:
47-
sudo cp $(BUILDDIR)/Release/CodecCommanderClient /usr/bin/hda-verb
48-
if [ "`which tag`" != "" ]; then sudo tag -a Blue /usr/bin/hda-verb; fi
44+
if [ ! -d $(BINDIR) ]; then sudo mkdir -p $(BINDIR); fi
45+
sudo cp $(BUILDDIR)/Release/CodecCommanderClient $(BINDIR)/hda-verb
46+
if [ "`which tag`" != "" ]; then sudo tag -a Blue $(BINDIR)/hda-verb; fi
4947
sudo rm -Rf $(INSTDIR)/$(KEXT)
5048
sudo cp -R $(BUILDDIR)/Release/$(KEXT) $(INSTDIR)
5149
if [ "`which tag`" != "" ]; then sudo tag -a Blue $(INSTDIR)/$(KEXT); fi
52-
make update_kernelcache
50+
$(MAKE) update_kernelcache
51+
endif
52+
53+
# common bits below ----------------------------------------------------
54+
55+
ifeq ($(findstring 32,$(BITS)),32)
56+
OPTIONS:=$(OPTIONS) -arch i386
57+
endif
58+
59+
ifeq ($(findstring 64,$(BITS)),64)
60+
OPTIONS:=$(OPTIONS) -arch x86_64
61+
endif
62+
63+
OPTIONS += -scheme CodecCommander
64+
65+
.PHONY: all clean distribute
66+
67+
all:
68+
xcodebuild build $(OPTIONS) -configuration Debug
69+
xcodebuild build $(OPTIONS) -configuration Release
70+
71+
clean:
72+
xcodebuild clean $(OPTIONS) -configuration Debug
73+
xcodebuild clean $(OPTIONS) -configuration Release
5374

54-
.PHONY: distribute
5575
distribute:
5676
if [ -e ./Distribute ]; then rm -r ./Distribute; fi
5777
mkdir ./Distribute
5878
cp -R $(BUILDDIR)/Debug ./Distribute
5979
cp -R $(BUILDDIR)/Release ./Distribute
60-
cp README.md ./Distribute
61-
cp LICENSE ./Distribute
62-
mv ./Distribute/Debug/CodecCommanderClient ./Distribute/Debug/hda-verb
63-
mv ./Distribute/Release/CodecCommanderClient ./Distribute/Release/hda-verb
80+
cp README.md ./Distribute/Debug
81+
cp README.md ./Distribute/Release
82+
cp LICENSE ./Distribute/Debug
83+
cp LICENSE ./Distribute/Release
6484
find ./Distribute -path *.DS_Store -delete
6585
find ./Distribute -path *.dSYM -exec echo rm -r {} \; >/tmp/org.voodoo.rm.dsym.sh
6686
chmod +x /tmp/org.voodoo.rm.dsym.sh
6787
/tmp/org.voodoo.rm.dsym.sh
6888
rm /tmp/org.voodoo.rm.dsym.sh
69-
ditto -c -k --sequesterRsrc --zlibCompressionLevel 9 ./Distribute ./Archive.zip
70-
mv ./Archive.zip ./Distribute/`date +$(DIST)-%Y-%m%d.zip`
89+
ditto -c -k --sequesterRsrc --zlibCompressionLevel 9 ./Distribute/Release ./Archive_Release.zip
90+
ditto -c -k --sequesterRsrc --zlibCompressionLevel 9 ./Distribute/Debug ./Archive_Debug.zip
91+
mv ./Archive_Release.zip ./Distribute/$(DIST)-$(VERSION_MODULE)-RELEASE.zip
92+
mv ./Archive_Debug.zip ./Distribute/$(DIST)-$(VERSION_MODULE)-DEBUG.zip

print_module_version.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
SCHEME="CodecCommander"
3+
CONFIG="Release"
4+
5+
VERSION=$(
6+
xcodebuild \
7+
-scheme "$SCHEME" \
8+
-configuration "$CONFIG" \
9+
-showBuildSettings 2>/dev/null \
10+
| awk -F= '/CURRENT_PROJECT_VERSION/ {
11+
# strip all spaces from the RHS
12+
gsub(/ /,"",$2)
13+
print $2
14+
exit
15+
}'
16+
)
17+
18+
if [[ -n "$VERSION" ]]; then
19+
echo "$VERSION"
20+
else
21+
echo "ERROR: could not read CURRENT_PROJECT_VERSION" >&2
22+
exit 1
23+
fi

print_version.sh

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
#set -x
1+
#!/usr/bin/env bash
22

3-
# extract minor version (eg. 10.9 vs. 10.10 vs. 10.11)
4-
MINOR_VER=$([[ "$(sw_vers -productVersion)" =~ [0-9]+\.([0-9]+) ]] && echo ${BASH_REMATCH[1]})
5-
if [[ $MINOR_VER -ge 11 ]]; then
6-
echo 10.11+
3+
version=$(sw_vers -productVersion)
4+
if [[ "$version" =~ ^([0-9]+)\.([0-9]+) ]]; then
5+
major=${BASH_REMATCH[1]}
6+
minor=${BASH_REMATCH[2]}
7+
if (( major > 10 )); then
8+
# Big Sur (11) or above
9+
echo "11+"
10+
elif (( minor <= 10 )); then
11+
# 10.0 – 10.10
12+
echo "10.10-"
13+
else
14+
# 10.11 – 10.15
15+
echo "10.11-10.15"
16+
fi
717
else
8-
echo 10.10-
9-
fi
18+
echo "unknown"
19+
fi

0 commit comments

Comments
 (0)