-
Notifications
You must be signed in to change notification settings - Fork 450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Started holding a reference to the products request #163
base: master
Are you sure you want to change the base?
Conversation
Added support for tvOS to pod file. Confirmed working on Apple TV. |
+10 super useful stuff, really interested in this being merged |
@Megatron1000 When I try to build your fork, I get "ld: in projectnamelibs/RMStore/Optional/openssl-1.0.1e/lib/libssl.a(s2_meth.o), building for tvOS, but linking in object file built for iOS, for architecture arm64 Any ideas on how to fix? |
@cerupcat You need to build OpenSSL for tvOS. I used this from a gist I found: #!/bin/bash
# This script downloads and builds the iOS, tvOS and Mac openSSL libraries with Bitcode enabled
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
# https://gist.github.com/foozmeat/5154962
# Peter Steinberger, PSPDFKit GmbH, @steipete.
# Felix Schwarz, IOSPIRIT GmbH, @felix_schwarz.
set -e
usage ()
{
echo "usage: $0 [iOS SDK version (defaults to latest)] [tvOS SDK version (defaults to latest)] [OS X minimum deployment target (defaults to 10.7)]"
exit 127
}
if [ $1 -e "-h" ]; then
usage
fi
if [ -z $1 ]; then
IOS_SDK_VERSION="" #"9.1"
IOS_MIN_SDK_VERSION="8.0"
TVOS_SDK_VERSION="" #"9.0"
TVOS_MIN_SDK_VERSION="9.0"
OSX_DEPLOYMENT_TARGET="10.7"
else
IOS_SDK_VERSION=$1
TVOS_SDK_VERSION=$2
OSX_DEPLOYMENT_TARGET=$3
fi
OPENSSL_VERSION="openssl-1.0.2e"
DEVELOPER=`xcode-select -print-path`
buildMac()
{
ARCH=$1
echo "Building ${OPENSSL_VERSION} for ${ARCH}"
TARGET="darwin-i386-cc"
if [[ $ARCH == "x86_64" ]]; then
TARGET="darwin64-x86_64-cc"
fi
export CC="${BUILD_TOOLS}/usr/bin/clang -fembed-bitcode -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET}"
pushd . > /dev/null
cd "${OPENSSL_VERSION}"
./Configure no-asm ${TARGET} --openssldir="/tmp/${OPENSSL_VERSION}-${ARCH}" &> "/tmp/${OPENSSL_VERSION}-${ARCH}.log"
make >> "/tmp/${OPENSSL_VERSION}-${ARCH}.log" 2>&1
make install_sw >> "/tmp/${OPENSSL_VERSION}-${ARCH}.log" 2>&1
make clean >> "/tmp/${OPENSSL_VERSION}-${ARCH}.log" 2>&1
popd > /dev/null
}
buildIOS()
{
ARCH=$1
pushd . > /dev/null
cd "${OPENSSL_VERSION}"
if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]]; then
PLATFORM="iPhoneSimulator"
else
PLATFORM="iPhoneOS"
sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c"
fi
export $PLATFORM
export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
export CROSS_SDK="${PLATFORM}${IOS_SDK_VERSION}.sdk"
export BUILD_TOOLS="${DEVELOPER}"
export CC="${BUILD_TOOLS}/usr/bin/gcc -fembed-bitcode -arch ${ARCH}"
echo "Building ${OPENSSL_VERSION} for ${PLATFORM} ${IOS_SDK_VERSION} ${ARCH}"
if [[ "${ARCH}" == "x86_64" ]]; then
./Configure no-asm darwin64-x86_64-cc --openssldir="/tmp/${OPENSSL_VERSION}-iOS-${ARCH}" &> "/tmp/${OPENSSL_VERSION}-iOS-${ARCH}.log"
else
./Configure iphoneos-cross --openssldir="/tmp/${OPENSSL_VERSION}-iOS-${ARCH}" &> "/tmp/${OPENSSL_VERSION}-iOS-${ARCH}.log"
fi
# add -isysroot to CC=
sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -miphoneos-version-min=${IOS_MIN_SDK_VERSION} !" "Makefile"
make >> "/tmp/${OPENSSL_VERSION}-iOS-${ARCH}.log" 2>&1
make install_sw >> "/tmp/${OPENSSL_VERSION}-iOS-${ARCH}.log" 2>&1
make clean >> "/tmp/${OPENSSL_VERSION}-iOS-${ARCH}.log" 2>&1
popd > /dev/null
}
buildTVOS()
{
ARCH=$1
pushd . > /dev/null
cd "${OPENSSL_VERSION}"
if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]]; then
PLATFORM="AppleTVSimulator"
else
PLATFORM="AppleTVOS"
sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c"
fi
export $PLATFORM
export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
export CROSS_SDK="${PLATFORM}${TVOS_SDK_VERSION}.sdk"
export BUILD_TOOLS="${DEVELOPER}"
export CC="${BUILD_TOOLS}/usr/bin/gcc -fembed-bitcode -arch ${ARCH}"
echo "Building ${OPENSSL_VERSION} for ${PLATFORM} ${TVOS_SDK_VERSION} ${ARCH}"
# Patch apps/speed.c to not use fork() since it's not available on tvOS
LANG=C sed -i -- 's/define HAVE_FORK 1/define HAVE_FORK 0/' "./apps/speed.c"
# Patch Configure to build for tvOS, not iOS
LANG=C sed -i -- 's/D\_REENTRANT\:iOS/D\_REENTRANT\:tvOS/' "./Configure"
chmod u+x ./Configure
if [[ "${ARCH}" == "x86_64" ]]; then
./Configure no-asm darwin64-x86_64-cc --openssldir="/tmp/${OPENSSL_VERSION}-tvOS-${ARCH}" &> "/tmp/${OPENSSL_VERSION}-tvOS-${ARCH}.log"
else
./Configure iphoneos-cross --openssldir="/tmp/${OPENSSL_VERSION}-tvOS-${ARCH}" &> "/tmp/${OPENSSL_VERSION}-tvOS-${ARCH}.log"
fi
# add -isysroot to CC=
sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -mtvos-version-min=${TVOS_MIN_SDK_VERSION} !" "Makefile"
make >> "/tmp/${OPENSSL_VERSION}-tvOS-${ARCH}.log" 2>&1
make install_sw >> "/tmp/${OPENSSL_VERSION}-tvOS-${ARCH}.log" 2>&1
make clean >> "/tmp/${OPENSSL_VERSION}-tvOS-${ARCH}.log" 2>&1
popd > /dev/null
}
echo "Cleaning up"
rm -rf include/openssl/* lib/*
mkdir -p lib
mkdir -p include/openssl/
rm -rf "/tmp/${OPENSSL_VERSION}-*"
rm -rf "/tmp/${OPENSSL_VERSION}-*.log"
rm -rf "${OPENSSL_VERSION}"
if [ ! -e ${OPENSSL_VERSION}.tar.gz ]; then
echo "Downloading ${OPENSSL_VERSION}.tar.gz"
wget https://www.openssl.org/source/${OPENSSL_VERSION}.tar.gz
else
echo "Using ${OPENSSL_VERSION}.tar.gz"
fi
echo "Unpacking openssl"
tar xfz "${OPENSSL_VERSION}.tar.gz"
buildTVOS "arm64"
buildTVOS "x86_64"
echo "Building tvOS libraries"
lipo \
"/tmp/${OPENSSL_VERSION}-tvOS-arm64/lib/libcrypto.a" \
"/tmp/${OPENSSL_VERSION}-tvOS-x86_64/lib/libcrypto.a" \
-create -output lib/libcrypto_tvOS.a
lipo \
"/tmp/${OPENSSL_VERSION}-tvOS-arm64/lib/libssl.a" \
"/tmp/${OPENSSL_VERSION}-tvOS-x86_64/lib/libssl.a" \
-create -output lib/libssl_tvOS.a
echo "Cleaning up"
rm -rf /tmp/${OPENSSL_VERSION}-*
rm -rf ${OPENSSL_VERSION}
echo "Done" |
This is an easy enough change. I fully recommend to merge this. |
Poking this thread. Any idea when this will land? Hoping to use RMStore in my tvOS app |
@Mazyod i get the follow error with your script: sed: RE error: illegal byte sequence |
Tried to use this on tvOS but the neither the success or failure block was ever called when requesting products with IDs. Turns out you need to hold a reference to the product request for this to work.