Skip to content

Commit 8b7b91f

Browse files
committed
[global] Get a rootless build going
1 parent a8764bd commit 8b7b91f

File tree

4 files changed

+39
-8
lines changed

4 files changed

+39
-8
lines changed

Makefile

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
ifeq ($(BUILD_LEGACY_ARM64E),1)
1+
ifeq ($(ROOTLESS),1)
2+
export THEOS_PACKAGE_SCHEME = rootless
3+
export TARGET = iphone:latest:15.0
4+
else ifeq ($(BUILD_LEGACY_ARM64E),1)
25
export TARGET = iphone:13.7:12.0
36
else
47
export TARGET = iphone:latest:12.0
58
endif
69

7-
FRAMEWORK_OUTPUT_DIR = $(THEOS_OBJ_DIR)/install/Library/Frameworks
10+
FRAMEWORK_OUTPUT_DIR = $(THEOS_OBJ_DIR)/install$(THEOS_PACKAGE_INSTALL_PREFIX)/Library/Frameworks
811
ALDERIS_SDK_DIR = $(THEOS_OBJ_DIR)/alderis_sdk_$(THEOS_PACKAGE_BASE_VERSION)
912

10-
export ADDITIONAL_CFLAGS = -fobjc-arc -Wextra -Wno-unused-parameter -F$(FRAMEWORK_OUTPUT_DIR)
13+
export ADDITIONAL_CFLAGS = -fobjc-arc \
14+
-Wextra -Wno-unused-parameter \
15+
-F$(FRAMEWORK_OUTPUT_DIR)
1116
export ADDITIONAL_LDFLAGS = -F$(FRAMEWORK_OUTPUT_DIR)
1217

1318
INSTALL_TARGET_PROCESSES = Preferences
@@ -16,17 +21,34 @@ include $(THEOS)/makefiles/common.mk
1621

1722
XCODEPROJ_NAME = Alderis
1823

19-
Alderis_XCODEFLAGS = DYLIB_INSTALL_NAME_BASE=/Library/Frameworks BUILD_LIBRARY_FOR_DISTRIBUTION=YES ARCHS="$(ARCHS)"
24+
Alderis_XCODEFLAGS = \
25+
DYLIB_INSTALL_NAME_BASE=@rpath \
26+
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
27+
LOCAL_LIBRARY_DIR="$(THEOS_PACKAGE_INSTALL_PREFIX)/Library" \
28+
ARCHS="$(ARCHS)"
2029

2130
SUBPROJECTS = lcpshim
2231

2332
include $(THEOS_MAKE_PATH)/xcodeproj.mk
2433
include $(THEOS_MAKE_PATH)/aggregate.mk
2534

35+
after-Alderis-all::
36+
ifeq ($(ROOTLESS),1)
37+
@rm -f $(FRAMEWORK_OUTPUT_DIR)/Alderis.framework/Assets.car
38+
@ldid -S $(FRAMEWORK_OUTPUT_DIR)/Alderis.framework
39+
endif
40+
2641
internal-stage::
27-
# Copy postinst
28-
mkdir -p $(THEOS_STAGING_DIR)/DEBIAN
29-
cp postinst $(THEOS_STAGING_DIR)/DEBIAN
42+
ifneq ($(ROOTLESS),1)
43+
@mkdir -p $(THEOS_STAGING_DIR)/DEBIAN
44+
@cp postinst $(THEOS_STAGING_DIR)/DEBIAN
45+
endif
46+
47+
internal-package::
48+
ifeq ($(ROOTLESS),1)
49+
@grep -v Depends: $(THEOS_STAGING_DIR)/DEBIAN/control > tmp
50+
@mv tmp $(THEOS_STAGING_DIR)/DEBIAN/control
51+
endif
3052

3153
docs:
3254
@$(PRINT_FORMAT_MAKING) "Generating docs"

lcpshim/HBColorPickerTableCell.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ - (void)_present {
110110
configuration.supportsAlpha = self._hbcp_supportsAlpha;
111111
_viewController.configuration = configuration;
112112

113-
UIViewController *rootViewController = self._viewControllerForAncestor ?: [UIApplication sharedApplication].keyWindow.rootViewController;
113+
UIViewController *rootViewController = self._viewControllerForAncestor ?: self.window.rootViewController;
114114
[rootViewController presentViewController:_viewController animated:YES completion:nil];
115115
}
116116

lcpshim/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ LIBRARY_NAME = libcolorpicker
44

55
libcolorpicker_FILES = $(wildcard *.m)
66
libcolorpicker_PRIVATE_FRAMEWORKS = Preferences
7+
libcolorpicker_INSTALL_PATH = $(THEOS_PACKAGE_INSTALL_PREFIX)/usr/lib
8+
libcolorpicker_LDFLAGS = -install_name @rpath/libcolorpicker.dylib
79

810
include $(THEOS_MAKE_PATH)/library.mk

lcpshim/PFColorAlert.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@ - (void)displayWithCompletion:(PFColorAlertCompletion)completion {
3636
configuration.supportsAlpha = _showAlpha;
3737
_viewController.configuration = configuration;
3838

39+
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_15_0
40+
// Theoretically can do unexpected things if multiple windows are open, but I don’t really care,
41+
// because this is a bad API design only included for compatibility.
42+
UIWindow *window = ((UIWindowScene *)[UIApplication sharedApplication].connectedScenes.anyObject).keyWindow;
43+
#else
3944
UIWindow *window = [UIApplication sharedApplication].keyWindow;
45+
#endif
46+
4047
_viewController.popoverPresentationController.sourceView = window;
4148
_viewController.popoverPresentationController.sourceRect = window.bounds;
4249
_viewController.popoverPresentationController.permittedArrowDirections = 0;

0 commit comments

Comments
 (0)