From 7a02413056f079ca7c28645bc947245996d64c9b Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 26 Jan 2014 16:22:57 -0800 Subject: [PATCH] Use an embedded copy of libvncserver for ARM64. --- .gitignore | 1 + .gitmodules | 3 +++ Tweak.mm | 2 +- control | 2 +- libvncserver | 1 + libvncserver.sh | 65 +++++++++++++++++++++++++++++++++++++++++++++++++ makefile | 12 ++++++--- 7 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 .gitmodules create mode 160000 libvncserver create mode 100755 libvncserver.sh diff --git a/.gitignore b/.gitignore index e512e52..d4d0aba 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ obj *.deb .theos _ +libvncserver.arm* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..7aff9c9 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libvncserver"] + path = libvncserver + url = https://github.com/SaurikIT/libvncserver.git diff --git a/Tweak.mm b/Tweak.mm index a255503..0d49df7 100644 --- a/Tweak.mm +++ b/Tweak.mm @@ -105,7 +105,7 @@ extern "C" void CoreSurfaceBufferFlushProcessorCaches(CoreSurfaceBufferRef buffe typedef void *CoreSurfaceAcceleratorRef; -extern "C" int CoreSurfaceAcceleratorCreate(CFAllocatorRef allocator, int type, CoreSurfaceAcceleratorRef *accel); +extern "C" int CoreSurfaceAcceleratorCreate(CFAllocatorRef allocator, void *type, CoreSurfaceAcceleratorRef *accel); extern "C" unsigned int CoreSurfaceAcceleratorTransferSurface(CoreSurfaceAcceleratorRef accelerator, CoreSurfaceBufferRef dest, CoreSurfaceBufferRef src, CFDictionaryRef options/*, void *, void *, void **/); typedef void *IOMobileFramebufferRef; diff --git a/control b/control index 18316b2..68e0398 100644 --- a/control +++ b/control @@ -7,7 +7,7 @@ Maintainer: Jay Freeman (saurik) Architecture: iphoneos-arm Description: a VNC /server/ for the iPhone Name: Veency -Depends: mobilesubstrate (>= 0.9.2966-1), libvncserver, com.saurik.iphone.ske, preferenceloader, jp.ashikase.mousesupport | firmware (<< 3.0), libstatusbar | firmware (<< 4.0), firmware (<< 6.0) | ch.ringwald.springboardaccess +Depends: mobilesubstrate (>= 0.9.2966-1), com.saurik.iphone.ske, preferenceloader, jp.ashikase.mousesupport | firmware (<< 3.0), libstatusbar | firmware (<< 4.0), firmware (<< 6.0) | ch.ringwald.springboardaccess Author: Jay Freeman (saurik) Depiction: http://cydia.saurik.com/info/veency/ Tag: purpose::daemon, role::enduser diff --git a/libvncserver b/libvncserver new file mode 160000 index 0000000..30e11cf --- /dev/null +++ b/libvncserver @@ -0,0 +1 @@ +Subproject commit 30e11cfcd39a8bf7ec3038bff6803d031a4d4dfe diff --git a/libvncserver.sh b/libvncserver.sh new file mode 100755 index 0000000..70fef63 --- /dev/null +++ b/libvncserver.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +# Cycript - Optimizing JavaScript Compiler/Runtime +# Copyright (C) 2009-2013 Jay Freeman (saurik) + +# GNU General Public License, Version 3 {{{ +# +# Cycript is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 3 of the License, +# or (at your option) any later version. +# +# Cycript is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Cycript. If not, see . +# }}} + +set -e + +archs=() +function arch() { + local arch=$1 + local host=$2 + local sdk=$3 + local os=$4 + local min=$5 + shift 5 + + rm -rf "libvncserver.${arch}" + if ! isysroot=$(xcodebuild -sdk "${sdk}" -version Path); then + return + fi + + archs+=("${arch}") + mkdir "libvncserver.${arch}" + + flags=() + flags+=(-isysroot "${isysroot}") + flags+=(-m${os}-version-min="${min}") + flags+=(-O3 -g3) + flags+=(-fvisibility=hidden) + + if [[ ${arch} == arm* && ${arch} != arm64 ]]; then + flags+=(-mthumb) + fi + + cd "libvncserver.${arch}" + CC="clang -arch ${arch}" CXX="clang++ -arch ${arch}" CFLAGS="${flags[*]}" CPPFLAGS="${flags[*]} $*" ../libvncserver/configure --host="${host}" --disable-shared + make + cd .. +} + +arch armv6 arm-apple-darwin10 iphoneos iphoneos 2.0 -mllvm -arm-reserve-r9 +arch arm64 aarch64-apple-darwin11 iphoneos iphoneos 2.0 + +libvncserver=() +for arch in "${archs[@]}"; do + libvncserver+=(libvncserver."${arch}"/.libs/libvncserver.a) +done + +lipo -create -output libvncserver.a "${libvncserver[@]}" diff --git a/makefile b/makefile index d7852c1..42dde6e 100644 --- a/makefile +++ b/makefile @@ -1,5 +1,5 @@ TARGET := iphone:7.0:2.0 -ARCHS := armv6 #arm64 +ARCHS := armv6 arm64 PACKAGE_VERSION := $(shell ./version.sh) include theos/makefiles/common.mk @@ -17,12 +17,18 @@ Veency_FRAMEWORKS += UIKit ADDITIONAL_OBJCFLAGS += -Wno-gnu ADDITIONAL_OBJCFLAGS += -Wno-dangling-else -ADDITIONAL_OBJCFLAGS += -Isysroot/usr/include ADDITIONAL_OBJCFLAGS += -idirafter . +ADDITIONAL_OBJCFLAGS += -Ilibvncserver +ADDITIONAL_OBJCFLAGS += -Xarch_armv6 -Ilibvncserver.armv6 +ADDITIONAL_OBJCFLAGS += -Xarch_arm64 -Ilibvncserver.arm64 + ADDITIONAL_CFLAGS += -fvisibility=hidden -ADDITIONAL_LDFLAGS += -Lsysroot/usr/lib -lvncserver +ADDITIONAL_LDFLAGS += -Xarch_armv6 -Llibvncserver.armv6/libvncserver/.libs +ADDITIONAL_LDFLAGS += -Xarch_arm64 -Llibvncserver.arm64/libvncserver/.libs +ADDITIONAL_LDFLAGS += -lvncserver -lz + ADDITIONAL_LDFLAGS += -F/System/Library/PrivateFrameworks ADDITIONAL_LDFLAGS += -weak_reference_mismatches weak -- 2.45.2