diff --git a/Makefile b/Makefile index 25a5bb9..b81a682 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,16 @@ -ARCHS = armv7 armv7s arm64 -TARGET = iphone:clang:7.0:6.0 +ARCHS = arm64 +TARGET = iphone:clang:16.5:6.0 include theos/makefiles/common.mk TOOL_NAME = pbcopy pbpaste pbcopy_FILES = pbcopy.m -pbcopy_FRAMEWORKS = UIKit Foundation MobileCoreServices +pbcopy_FRAMEWORKS = UIKit Foundation +pbcopy_CODESIGN_FLAGS = -Sentitlements.plist pbpaste_FILES = pbpaste.m -pbpaste_FRAMEWORKS = UIKit Foundation MobileCoreServices +pbpaste_FRAMEWORKS = UIKit Foundation +pbpaste_CODESIGN_FLAGS = -Sentitlements.plist include $(THEOS_MAKE_PATH)/tool.mk diff --git a/build_deb.sh b/build_deb.sh new file mode 100755 index 0000000..6fc8ed0 --- /dev/null +++ b/build_deb.sh @@ -0,0 +1,50 @@ +#!/bin/bash +set -e + +RELEASE=0 +CLEAN=0 +ROOTLESS=1 + +usage() { + echo "Usage: $0 [-r] [-c] [--rootful]" + echo " -r Release build (strips debug symbols)" + echo " -c Clean before building" + echo " --rootful Build for rootful jailbreak (default: rootless)" + exit 1 +} + +while [[ $# -gt 0 ]]; do + case $1 in + -r) RELEASE=1 ;; + -c) CLEAN=1 ;; + --rootful) ROOTLESS=0 ;; + -h|--help) usage ;; + *) usage ;; + esac + shift +done + +MAKE_ARGS=() + +if [ $ROOTLESS -eq 1 ]; then + MAKE_ARGS+=(THEOS_PACKAGE_SCHEME=rootless) + echo "Scheme: rootless (iphoneos-arm64, prefix /var/jb)" +else + echo "Scheme: rootful (iphoneos-arm)" +fi + +[ $CLEAN -eq 1 ] && make clean "${MAKE_ARGS[@]}" + +if [ $RELEASE -eq 1 ]; then + MAKE_ARGS+=(FINALPACKAGE=1) +fi + +make package "${MAKE_ARGS[@]}" + +DEB=$(ls -t packages/*.deb 2>/dev/null | head -1) +if [ -n "$DEB" ]; then + echo "Output: $DEB" +else + echo "Error: no .deb found in packages/" >&2 + exit 1 +fi diff --git a/entitlements.plist b/entitlements.plist new file mode 100644 index 0000000..f690fdf --- /dev/null +++ b/entitlements.plist @@ -0,0 +1,16 @@ + + + + + platform-application + + com.apple.private.security.no-sandbox + + com.apple.private.skip-library-validation + + application-identifier + com.ariweinstein.pbtools + com.apple.Pasteboard.background-access + + + diff --git a/pbcopy.m b/pbcopy.m index 2378bc0..413d7c1 100644 --- a/pbcopy.m +++ b/pbcopy.m @@ -1,12 +1,11 @@ #import -#import int pbcopy(NSString *pasteboardType) { NSFileHandle *input = [NSFileHandle fileHandleWithStandardInput]; NSData *inputData = [NSData dataWithData:[input readDataToEndOfFile]]; if (!pasteboardType) - pasteboardType = (NSString *)kUTTypeText; + pasteboardType = @"public.text"; [[UIPasteboard generalPasteboard] setData:inputData forPasteboardType:pasteboardType]; return !inputData; diff --git a/pbpaste.m b/pbpaste.m index af12ae4..ea66160 100644 --- a/pbpaste.m +++ b/pbpaste.m @@ -1,5 +1,4 @@ #import -#import int pbpaste(NSString *pasteboardType) { UIPasteboard *clipboard = [UIPasteboard generalPasteboard]; @@ -24,7 +23,7 @@ int main(int argc, char **argv, char **envp) { } } else { // UIPasteboardTypeListString is nil for some reason; no time to debug right now - NSArray *stringTypes = @[(id)kUTTypeText, (id)kUTTypePlainText, (id)kUTTypeUTF8PlainText]; + NSArray *stringTypes = @[@"public.text", @"public.plain-text", @"public.utf8-plain-text"]; int result; for (NSString *type in stringTypes) {