Skip to content

Commit

Permalink
Apple silicon is overdue for support (#44)
Browse files Browse the repository at this point in the history
Add support for Apple ARM processors by building pcre2 from source rather than using a pre-built static library stored in the repo, and making sure we create a fat library with code for both x86 and ARM64 architectures.

This adds a new build target in Xcode for pcre2 and a special build script. It also updates the minimum required version of MacOS to 11.0 (it used to be 10.12).

I’ve had a working alpha of this out for a year(!), and this finally cleans up the way that was built.

Fixes #41.
  • Loading branch information
Mr0grog authored Nov 4, 2022
1 parent 36eaa8f commit eefaac0
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 1,280 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is a TextMate plug-in that provides support for [EditorConfig](http://edito

Download it now at: https://github.com/Mr0grog/editorconfig-textmate/releases/latest

EditorConfig-TextMate only supports TextMate 2 (see below for information about TextMate 1).
EditorConfig-TextMate only supports TextMate 2 (see below for information about TextMate 1) on MacOS 11.0 or later. It should work with both Intel and Apple processors.


Feature Support
Expand Down
100 changes: 83 additions & 17 deletions editorconfig-textmate.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,22 @@
CB60467916F6B558004753CD /* Run Script */,
);
dependencies = (
CBBD16AC29148BA20022E52D /* PBXTargetDependency */,
);
name = "EditorConfig-Core";
productName = "Install & Run in TM";
};
CBBD16A6291485F20022E52D /* PCRE2 */ = {
isa = PBXAggregateTarget;
buildConfigurationList = CBBD16A8291485F20022E52D /* Build configuration list for PBXAggregateTarget "PCRE2" */;
buildPhases = (
CBBD16A7291485F20022E52D /* Run Script */,
);
dependencies = (
);
name = PCRE2;
productName = "Install & Run in TM";
};
/* End PBXAggregateTarget section */

/* Begin PBXBuildFile section */
Expand All @@ -41,8 +53,8 @@
CB47C5C715C05DCA00E068C7 /* ECConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = CB47C5C615C05DCA00E068C7 /* ECConstants.m */; };
CB60468716F6D0FE004753CD /* libeditorconfig_static.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CB60468616F6D0EC004753CD /* libeditorconfig_static.a */; };
CB993E4F1DDF797500D3050B /* NSObject+ECDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = CB993E4E1DDF797500D3050B /* NSObject+ECDocument.m */; };
CBACAC642339B31300F3B043 /* libpcre2-8.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CBACAC632339B31300F3B043 /* libpcre2-8.a */; };
CBACAC6D233A7FED00F3B043 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = CBACAC6C233A7FED00F3B043 /* LICENSE */; };
CBBD16AD2914C01F0022E52D /* libpcre2-8.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CBACAC632339B31300F3B043 /* libpcre2-8.a */; };
CBE13DF31E206EA40069F96C /* ECSettings.m in Sources */ = {isa = PBXBuildFile; fileRef = CBE13DF21E206EA40069F96C /* ECSettings.m */; };
CBFF551715C35A8E0075328B /* NSView+EditorConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = CBFF551615C35A8E0075328B /* NSView+EditorConfig.m */; };
/* End PBXBuildFile section */
Expand All @@ -62,6 +74,13 @@
remoteGlobalIDString = CB60467616F6B558004753CD;
remoteInfo = "EditorConfig-Core";
};
CBBD16AB29148BA20022E52D /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = CB47C58F15C0538700E068C7 /* Project object */;
proxyType = 1;
remoteGlobalIDString = CBBD16A6291485F20022E52D;
remoteInfo = PCRE2;
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -101,7 +120,7 @@
CB60468616F6D0EC004753CD /* libeditorconfig_static.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libeditorconfig_static.a; path = editorconfig/libeditorconfig_static.a; sourceTree = BUILT_PRODUCTS_DIR; };
CB993E4D1DDF797500D3050B /* NSObject+ECDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+ECDocument.h"; sourceTree = "<group>"; };
CB993E4E1DDF797500D3050B /* NSObject+ECDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+ECDocument.m"; sourceTree = "<group>"; };
CBACAC632339B31300F3B043 /* libpcre2-8.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libpcre2-8.a"; path = "lib/pcre/libpcre2-8.a"; sourceTree = "<group>"; };
CBACAC632339B31300F3B043 /* libpcre2-8.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libpcre2-8.a"; path = "pcre2/lib/libpcre2-8.a"; sourceTree = BUILT_PRODUCTS_DIR; };
CBACAC6C233A7FED00F3B043 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
CBE13DF11E206EA40069F96C /* ECSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ECSettings.h; sourceTree = "<group>"; };
CBE13DF21E206EA40069F96C /* ECSettings.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ECSettings.m; sourceTree = "<group>"; };
Expand All @@ -115,8 +134,8 @@
buildActionMask = 2147483647;
files = (
CB47C59C15C0538800E068C7 /* Cocoa.framework in Frameworks */,
CBBD16AD2914C01F0022E52D /* libpcre2-8.a in Frameworks */,
CB60468716F6D0FE004753CD /* libeditorconfig_static.a in Frameworks */,
CBACAC642339B31300F3B043 /* libpcre2-8.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -284,6 +303,7 @@
CB47C59715C0538700E068C7 /* editorconfig-textmate */,
CB47C5D515C07CFB00E068C7 /* Install & Run in TM */,
CB60467616F6B558004753CD /* EditorConfig-Core */,
CBBD16A6291485F20022E52D /* PCRE2 */,
);
};
/* End PBXProject section */
Expand Down Expand Up @@ -326,7 +346,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cp \"$SRCROOT/lib/editorconfig-core/LICENSE\" \"$BUILT_PRODUCTS_DIR/$WRAPPER_NAME/Contents/Resources/LICENSE-editorconfig-core\"\ncp \"$SRCROOT/lib/pcre/LICENCE-pcre\" \"$BUILT_PRODUCTS_DIR/$WRAPPER_NAME/Contents/Resources/LICENSE-pcre\"\n";
shellScript = "cp \"$BUILT_PRODUCTS_DIR/editorconfig/LICENSE\" \"$BUILT_PRODUCTS_DIR/$WRAPPER_NAME/Contents/Resources/LICENSE-editorconfig-core\"\ncp \"$BUILT_PRODUCTS_DIR/pcre2/LICENCE\" \"$BUILT_PRODUCTS_DIR/$WRAPPER_NAME/Contents/Resources/LICENSE-pcre\"\n";
};
CB60467916F6B558004753CD /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -342,7 +362,23 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export PATH=\"/usr/local/bin/:$PATH\"\necho \"Building EditorConfig-Core...\"\ncd \"$PROJECT_DIR/lib/editorconfig-core\"\ncmake -D \"CMAKE_OSX_ARCHITECTURES:STRING=x86_64\" -DPCRE_LIBRARY=$PROJECT_DIR/lib/pcre/libpcre2-8.a -DPCRE2_INCLUDE_DIRS=$PROJECT_DIR/lib/pcre/include/ -DPCRE2_STATIC=ON -DBUILD_DOCUMENTATION=OFF\n \"$PROJECT_DIR/lib/editorconfig-core\"\nmake\nmkdir -p \"$BUILT_PRODUCTS_DIR/editorconfig\"\ncp \"lib/libeditorconfig_static.a\" \"$BUILT_PRODUCTS_DIR/editorconfig/\"\ncp \"$PROJECT_DIR/lib/editorconfig-core/include/editorconfig/\"* \"$BUILT_PRODUCTS_DIR/editorconfig/\"\ncp \"$PROJECT_DIR/lib/editorconfig-core/LICENSE\" \"$BUILT_PRODUCTS_DIR/editorconfig/\"\n";
shellScript = "export PATH=\"/usr/local/bin/:$PATH\"\necho \"Building EditorConfig-Core...\"\ncd \"$PROJECT_DIR/lib/editorconfig-core\"\ncmake \\\n -D \"CMAKE_OSX_ARCHITECTURES:STRING=x86_64;arm64\" \\\n -D \"CMAKE_OSX_DEPLOYMENT_TARGET:STRING=11.0\" \\\n -DPCRE2_LIBRARY_RELEASE=$BUILT_PRODUCTS_DIR/pcre2/lib/libpcre2-8.a \\\n -DPCRE2_INCLUDE_DIR=$BUILT_PRODUCTS_DIR/pcre2/include/ \\\n -DPCRE2_STATIC=ON \\\n -DBUILD_DOCUMENTATION=OFF \\\n \"$PROJECT_DIR/lib/editorconfig-core\"\nmake\nmkdir -p \"$BUILT_PRODUCTS_DIR/editorconfig\"\ncp \"lib/libeditorconfig_static.a\" \"$BUILT_PRODUCTS_DIR/editorconfig/\"\ncp \"$PROJECT_DIR/lib/editorconfig-core/include/editorconfig/\"* \"$BUILT_PRODUCTS_DIR/editorconfig/\"\ncp \"$PROJECT_DIR/lib/editorconfig-core/LICENSE\" \"$BUILT_PRODUCTS_DIR/editorconfig/\"\n";
};
CBBD16A7291485F20022E52D /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
"$(DERIVED_FILE_DIR)/editorconfig/libeditorconfig_static.a",
"$(DERIVED_FILE_DIR)/editorconfig/LICENSE",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -euo pipefail\n\nexport PATH=\"/usr/local/bin/:$PATH\"\nmkdir -p \"$BUILT_PRODUCTS_DIR/pcre2\"\n\n# Build\ncd \"$PROJECT_DIR/lib/pcre2\"\n./build-pcre2.sh \"$BUILT_PRODUCTS_DIR/pcre2\"\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down Expand Up @@ -374,6 +410,11 @@
target = CB60467616F6B558004753CD /* EditorConfig-Core */;
targetProxy = CB60467F16F6BCD7004753CD /* PBXContainerItemProxy */;
};
CBBD16AC29148BA20022E52D /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = CBBD16A6291485F20022E52D /* PCRE2 */;
targetProxy = CBBD16AB29148BA20022E52D /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
Expand Down Expand Up @@ -422,7 +463,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)/lib/**";
MACOSX_DEPLOYMENT_TARGET = 10.12;
MACOSX_DEPLOYMENT_TARGET = 11.0;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = macosx;
};
Expand Down Expand Up @@ -455,7 +496,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(SRCROOT)/lib/**";
MACOSX_DEPLOYMENT_TARGET = 10.12;
MACOSX_DEPLOYMENT_TARGET = 11.0;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = macosx;
};
Expand All @@ -470,7 +511,7 @@
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = "0.4.2-dev";
CURRENT_PROJECT_VERSION = "0.5.0-alpha2";
DEVELOPMENT_TEAM = HPJWEKK787;
ENABLE_HARDENED_RUNTIME = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
Expand All @@ -480,12 +521,12 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(BUILT_PRODUCTS_DIR)/pcre2/lib/**",
"$(BUILT_PRODUCTS_DIR)/editorconfig/**",
"$(PROJECT_DIR)/lib",
"$(PROJECT_DIR)/lib/pcre",
);
MARKETING_VERSION = "0.4.2-dev";
ONLY_ACTIVE_ARCH = YES;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = "0.5.0-alpha2";
ONLY_ACTIVE_ARCH = NO;
OTHER_CODE_SIGN_FLAGS = "--deep";
PRODUCT_BUNDLE_IDENTIFIER = "org.robbrackett.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -503,7 +544,7 @@
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = "0.4.2-dev";
CURRENT_PROJECT_VERSION = "0.5.0-alpha2";
DEVELOPMENT_TEAM = HPJWEKK787;
ENABLE_HARDENED_RUNTIME = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
Expand All @@ -513,12 +554,12 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(BUILT_PRODUCTS_DIR)/pcre2/lib/**",
"$(BUILT_PRODUCTS_DIR)/editorconfig/**",
"$(PROJECT_DIR)/lib",
"$(PROJECT_DIR)/lib/pcre",
);
MARKETING_VERSION = "0.4.2-dev";
ONLY_ACTIVE_ARCH = YES;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MARKETING_VERSION = "0.5.0-alpha2";
ONLY_ACTIVE_ARCH = NO;
OTHER_CODE_SIGN_FLAGS = "--deep";
PRODUCT_BUNDLE_IDENTIFIER = "org.robbrackett.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -559,6 +600,22 @@
};
name = Release;
};
CBBD16A9291485F20022E52D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
HEADER_SEARCH_PATHS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
CBBD16AA291485F20022E52D /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
HEADER_SEARCH_PATHS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
Expand Down Expand Up @@ -598,6 +655,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
CBBD16A8291485F20022E52D /* Build configuration list for PBXAggregateTarget "PCRE2" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CBBD16A9291485F20022E52D /* Debug */,
CBBD16AA291485F20022E52D /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = CB47C58F15C0538700E068C7 /* Project object */;
Expand Down
94 changes: 0 additions & 94 deletions lib/pcre/LICENCE-pcre

This file was deleted.

Loading

0 comments on commit eefaac0

Please sign in to comment.