Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
50 changes: 50 additions & 0 deletions build_deb.sh
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions entitlements.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>platform-application</key>
<true/>
<key>com.apple.private.security.no-sandbox</key>
<true/>
<key>com.apple.private.skip-library-validation</key>
<true/>
<key>application-identifier</key>
<string>com.ariweinstein.pbtools</string>
<key>com.apple.Pasteboard.background-access</key>
<true/>
</dict>
</plist>
3 changes: 1 addition & 2 deletions pbcopy.m
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#import <UIKit/UIKit.h>
#import <MobileCoreServices/MobileCoreServices.h>

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;
Expand Down
3 changes: 1 addition & 2 deletions pbpaste.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#import <UIKit/UIKit.h>
#import <MobileCoreServices/MobileCoreServices.h>

int pbpaste(NSString *pasteboardType) {
UIPasteboard *clipboard = [UIPasteboard generalPasteboard];
Expand All @@ -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) {
Expand Down