m1cpu: handle `kIOMainPortDefault` for macOS < 12 (#6)
`kIOMainPortDefault` was renamed from `kIOMasterPortDefault` in macOS
Monterey. This patch makes sure m1cpu can be built on Big Sur, too.
Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
diff --git a/cpu.go b/cpu.go
index a9b8fc5..9e55eb4 100644
--- a/cpu.go
+++ b/cpu.go
@@ -3,10 +3,15 @@
package m1cpu
// #cgo LDFLAGS: -framework CoreFoundation -framework IOKit
+// #include <AvailabilityMacros.h>
// #include <CoreFoundation/CoreFoundation.h>
// #include <IOKit/IOKitLib.h>
// #include <sys/sysctl.h>
//
+// #ifndef MAC_OS_VERSION_12_0
+// #define kIOMainPortDefault kIOMasterPortDefault
+// #endif
+//
// #define HzToGHz(hz) ((hz) / 1000000000.0)
//
// UInt64 global_pCoreHz;