merge latest master

This commit is contained in:
Robert Niederreiter 2016-03-04 09:28:08 +01:00
commit 270160d2cf
22 changed files with 1399 additions and 55 deletions

View file

@ -1,35 +1,33 @@
Kivy for IOS
Kivy for iOS
============
This toolchain is designed to compile the necessary library for iOS to run your
application, and manage the creation of the Xcode project.
This toolchain is designed to compile the necessary libraries for iOS to run
your application and manage the creation of the Xcode project.
Currently, we do not provide any binary distribution of this toolchain, but we
aim to do it. So you do need to compile it at least one time before being about
to create your Xcode project.
Currently, we do not provide any binary distributions of this toolchain, but we
aim to. Until then, you do need to compile it at least once before creating
your Xcode project.
The toolchain supports:
- iPhone Simulator (x86 and x86_64)
- iPhone / iOS (armv7 and arm64)
Theses recipes are not ported to the new toolchain yet:
These recipes are not ported to the new toolchain yet:
- openssl
- openssl-link
- lxml
Requirements
------------
Currently, the toolchain requires few tools to let you compile. You need:
Currently, the toolchain requires a few tools for compilation. You will need:
#. Xcode 6, with iOS SDK installed / command line tools::
#. Xcode 6 or above, with an iOS SDK and command line tools installed::
xcode-select --install
#. Using brew, you can install dependencies::
#. Using brew, you can install the following dependencies::
brew install autoconf automake libtool pkg-config
brew link libtool
@ -48,7 +46,7 @@ we call a `recipe` to compile it. For example, Python, libffi, SDL2, SDL_image,
freetype... all the dependencies, compilation and packaging instructions are
contained in a `recipe`.
You can list the available recipes and the version with::
You can list the available recipes and their versions with::
$ ./toolchain.py recipes
freetype 2.5.5
@ -56,6 +54,7 @@ You can list the available recipes and the version with::
ios master
kivy ios-poly-arch
libffi 3.2.1
openssl 1.0.2e
pyobjus master
python 2.7.1
sdl2 iOS-improvements
@ -63,29 +62,34 @@ You can list the available recipes and the version with::
sdl2_mixer 2.0.0
sdl2_ttf 2.0.12
Then, starts the compilation with::
Then, start the compilation with::
$ ./toolchain.py build kivy
The Kivy recipe depends on severals one, like all the sdl* and python. sdl2_ttf
depends on freetype, etc. You can think as: it will compile everything
You can build recipes at the same time by adding them as parameters::
$ ./toolchain.py build openssl kivy
The Kivy recipe depends on several others, like the sdl* and python recipes.
These may in turn depend on others e.g. sdl2_ttf depends on freetype, etc.
You can think of it as follows: the kivy recipe will compile everything
necessary for a minimal working version of Kivy.
Don't grab a coffee, just do diner. Compiling all the things the first time, 4x
(remember, 4 archs, 2 per platforms), it will take time. (todo: provide a way
to not compile for the simulator.).
Don't grab a coffee, just do diner. Compiling all the libraries for the first
time, 4x over (remember, 4 archs, 2 per platforms), will take time. (TODO:
provide a way to not compile for the simulator.).
Create the Xcode project
------------------------
The `toolchain.py` can create for you the initial Xcode project::
The `toolchain.py` can create the initial Xcode project for you::
$ # ./toolchain.py create <title> <app_directory>
$ ./toolchain.py create Touchtracer ~/code/kivy/examples/demo/touchtracer
Your app directory must contain a main.py. A directory named `<title>-ios`
will be created, with an Xcode project in it.
You can open the Xcode project::
You can open the Xcode project using::
$ open touchtracer-ios/touchtracer.xcodeproj
@ -102,3 +106,45 @@ FAQ
Fatal error: "stdio.h" file not found
You need to install the Command line tools: `xcode-select --install`
You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE)...
We don't support bitcode. You need to go to the your project setting, and disable bitcode
Support
-------
If you need assistance, you can ask for help on our mailing list:
* User Group : https://groups.google.com/group/kivy-users
* Email : kivy-users@googlegroups.com
We also have an IRC channel:
* Server : irc.freenode.net
* Port : 6667, 6697 (SSL only)
* Channel : #kivy
Contributing
------------
We love pull requests and discussing novel ideas. Check out our
`contribution guide <http://kivy.org/docs/contribute.html>`_ and
feel free to improve Kivy for iOS.
The following mailing list and IRC channel are used exclusively for
discussions about developing the Kivy framework and its sister projects:
* Dev Group : https://groups.google.com/group/kivy-dev
* Email : kivy-dev@googlegroups.com
IRC channel:
* Server : irc.freenode.net
* Port : 6667, 6697 (SSL only)
* Channel : #kivy-dev
License
-------
Kivy for iOS is released under the terms of the MIT License. Please refer to the
LICENSE file.

View file

@ -1,5 +1,5 @@
from toolchain import Recipe, shprint
from os.path import join
from os.path import join, exists
import sh
@ -8,6 +8,7 @@ class FFMpegRecipe(Recipe):
url = "http://www.ffmpeg.org/releases/ffmpeg-{version}.tar.bz2"
include_per_arch = True
include_dir = "dist/include"
optional_depends = ["openssl"]
libraries = [
"libavcodec/libavcodec.a",
"libavdevice/libavdevice.a",
@ -19,13 +20,42 @@ class FFMpegRecipe(Recipe):
"libswscale/libswscale.a"]
def build_arch(self, arch):
options = (
options = [
"--disable-everything",
"--enable-parser=h264,aac",
"--enable-decoder=h263,h264,aac",
"--enable-filter=aresample,resample,crop",
"--enable-protocol=file,http",
"--enable-demuxer=sdp",
"--enable-pic",
"--enable-small",
"--enable-hwaccels",
"--enable-static",
"--disable-shared",
# libpostproc is GPL: https://ffmpeg.org/pipermail/ffmpeg-user/2012-February/005162.html
"--enable-gpl",
# disable some unused algo
# note: "golomb" are the one used in our video test, so don't use --disable-golomb
# note: and for aac decoding: "rdft", "mdct", and "fft" are needed
"--disable-dxva2",
"--disable-vdpau",
"--disable-vaapi",
"--disable-dct",
# disable binaries / doc
"--enable-cross-compile",
"--disable-debug",
"--disable-programs",
"--disable-doc",
"--enable-pic",
"--enable-avresample")
"--enable-avresample"]
if "openssl.build_all" in self.ctx.state:
options += [
"--enable-openssl",
"--enable-nonfree",
"--enable-protocol=https,tls_openssl"]
build_env = arch.get_env()
build_env["VERBOSE"] = "1"
configure = sh.Command(join(self.build_dir, "configure"))
@ -39,6 +69,7 @@ class FFMpegRecipe(Recipe):
"--extra-ldflags={}".format(build_env["LDFLAGS"]),
*options,
_env=build_env)
"""
shprint(sh.sed,
"-i.bak",
"s/HAVE_CLOSESOCKET=yes//g",
@ -47,10 +78,12 @@ class FFMpegRecipe(Recipe):
"-i.bak",
"s/#define HAVE_CLOSESOCKET 1//g",
"config.h")
shprint(sh.sed,
"-i.bak",
"s/%define HAVE_CLOSESOCKET 1//g",
"config.asm")
if exists("config.asm"):
shprint(sh.sed,
"-i.bak",
"s/%define HAVE_CLOSESOCKET 1//g",
"config.asm")
"""
shprint(sh.make, "clean", _env=build_env)
shprint(sh.make, "-j4", _env=build_env)
shprint(sh.make, "install")

View file

@ -0,0 +1,52 @@
from toolchain import Recipe, shprint
import sh
class LibffiRecipe(Recipe):
version = "3.2.1"
url = "ftp://sourceware.org/pub/libffi/libffi-{version}.tar.gz"
library = "build/Release-{arch.sdk}/libffi.a"
include_per_arch = True
include_dir = "build_{arch.sdk}-{arch.arch}/include"
archs = ["x86_64"]
def build_all(self):
filtered_archs = self.filtered_archs
print("Build {} for {} (filtered)".format(
self.name,
", ".join([x.arch for x in filtered_archs])))
for arch in self.filtered_archs:
self.build(arch)
def prebuild_arch(self, arch):
if self.has_marker("patched"):
return
# necessary as it doesn't compile with XCode 6.0. If we use 5.1.1, the
# compiler for i386 is not working.
#shprint(sh.sed,
# "-i.bak",
# "s/-miphoneos-version-min=5.1.1/-miphoneos-version-min=6.0/g",
# "generate-darwin-source-and-headers.py")
self.apply_patch("fix-win32-unreferenced-symbol.patch")
self.apply_patch("public_include.patch")
self.apply_patch("staticlib.patch")
self.apply_patch("staticlib2.patch")
self.set_marker("patched")
def build_arch(self, arch):
shprint(sh.xcodebuild,
"ONLY_ACTIVE_ARCH=NO",
"ARCHS={}".format(arch.arch),
"-sdk", "macosx",
"install", "installhdrs",
"-project", "libffi.xcodeproj",
"-target", "libffi-Mac",
"-configuration", "Release",
"DSTROOT={}/hostlibffi".format(self.ctx.dist_dir))
def postbuild_arch(self, arch):
pass
recipe = LibffiRecipe()

View file

@ -0,0 +1,137 @@
--- libffi-3.0.13-old/src/arm/sysv.S 2013-03-16 12:19:39.000000000 +0100
+++ libffi-3.0.13-new/src/arm/sysv.S 2013-08-26 19:33:28.000000000 +0200
@@ -109,58 +109,35 @@
#define UNWIND @
#endif
+.syntax unified
#if defined(__thumb__) && !defined(__THUMB_INTERWORK__)
-.macro ARM_FUNC_START name
- .text
- .align 0
- .thumb
- .thumb_func
-#ifdef __APPLE__
- ENTRY($0)
+#define ARM_FUNC_START(name) \
+ .text; \
+ .align 4; \
+ .thumb; \
+ .thumb_func; \
+ ENTRY(name); \
+ bx pc; \
+ nop; \
+ .arm; \
+ UNWIND .fnstart; \
+_L__##name:
#else
- ENTRY(\name)
-#endif
- bx pc
- nop
- .arm
- UNWIND .fnstart
-/* A hook to tell gdb that we've switched to ARM mode. Also used to call
- directly from other local arm routines. */
-#ifdef __APPLE__
-_L__$0:
-#else
-_L__\name:
-#endif
-.endm
-#else
-.macro ARM_FUNC_START name
- .text
- .align 0
- .arm
-#ifdef __APPLE__
- ENTRY($0)
-#else
- ENTRY(\name)
-#endif
+#define ARM_FUNC_START(name) \
+ .text; \
+ .align 4; \
+ .arm; \
+ ENTRY(name); \
UNWIND .fnstart
-.endm
#endif
-.macro RETLDM regs=, cond=, dirn=ia
+.macro RETLDM
#if defined (__INTERWORKING__)
- .ifc "\regs",""
- ldr\cond lr, [sp], #4
- .else
- ldm\cond\dirn sp!, {\regs, lr}
- .endif
- bx\cond lr
+ ldr lr, [sp], #4
+ bx lr
#else
- .ifc "\regs",""
- ldr\cond pc, [sp], #4
- .else
- ldm\cond\dirn sp!, {\regs, pc}
- .endif
+ ldr pc, [sp], #4
#endif
.endm
@@ -170,8 +147,7 @@
@ r3: fig->flags
@ sp+0: ecif.rvalue
- @ This assumes we are using gas.
-ARM_FUNC_START ffi_call_SYSV
+ARM_FUNC_START(ffi_call_SYSV)
@ Save registers
stmfd sp!, {r0-r3, fp, lr}
UNWIND .save {r0-r3, fp, lr}
@@ -228,7 +204,7 @@
#if defined(__SOFTFP__) || defined(__ARM_EABI__)
cmpne r3, #FFI_TYPE_DOUBLE
#endif
- stmeqia r2, {r0, r1}
+ stmiaeq r2, {r0, r1}
#if !defined(__SOFTFP__) && !defined(__ARM_EABI__)
beq LSYM(Lepilogue)
@@ -266,7 +242,7 @@
void *args;
*/
-ARM_FUNC_START ffi_closure_SYSV
+ARM_FUNC_START(ffi_closure_SYSV)
UNWIND .pad #16
add ip, sp, #16
stmfd sp!, {ip, lr}
@@ -345,7 +321,7 @@
@ r3: fig->flags
@ sp+0: ecif.rvalue
-ARM_FUNC_START ffi_call_VFP
+ARM_FUNC_START(ffi_call_VFP)
@ Save registers
stmfd sp!, {r0-r3, fp, lr}
UNWIND .save {r0-r3, fp, lr}
@@ -410,7 +386,7 @@
beq LSYM(Lepilogue_vfp)
cmp r3, #FFI_TYPE_SINT64
- stmeqia r2, {r0, r1}
+ stmiaeq r2, {r0, r1}
beq LSYM(Lepilogue_vfp)
cmp r3, #FFI_TYPE_FLOAT
@@ -433,7 +409,7 @@
.size CNAME(ffi_call_VFP),.ffi_call_VFP_end-CNAME(ffi_call_VFP)
-ARM_FUNC_START ffi_closure_VFP
+ARM_FUNC_START(ffi_closure_VFP)
fstmfdd sp!, {d0-d7}
@ r0-r3, then d0-d7
UNWIND .pad #80

View file

@ -0,0 +1,94 @@
diff -Naur --exclude 'build*' --exclude darwin_ios --exclude '*.swp' ../armv7/libffi-3.2.1/generate-darwin-source-and-headers.py libffi-3.2.1/generate-darwin-source-and-headers.py
--- ../armv7/libffi-3.2.1/generate-darwin-source-and-headers.py 2015-02-11 02:28:30.000000000 +0100
+++ libffi-3.2.1/generate-darwin-source-and-headers.py 2015-02-11 12:33:38.000000000 +0100
@@ -19,7 +19,7 @@
prefix = "#ifdef __i386__\n\n"
suffix = "\n\n#endif"
src_dir = 'x86'
- src_files = ['darwin.S', 'win32.S', 'ffi.c']
+ src_files = ['darwin.S', 'ffi.c']
class simulator64_platform(Platform):
diff -Naur --exclude 'build*' --exclude darwin_ios --exclude '*.swp' ../armv7/libffi-3.2.1/src/x86/ffi.c libffi-3.2.1/src/x86/ffi.c
--- ../armv7/libffi-3.2.1/src/x86/ffi.c 2014-11-08 13:47:24.000000000 +0100
+++ libffi-3.2.1/src/x86/ffi.c 2015-02-11 12:41:27.000000000 +0100
@@ -393,6 +393,7 @@
case FFI_SYSV:
case FFI_MS_CDECL:
#endif
+#ifdef X86_WIN322
case FFI_STDCALL:
case FFI_THISCALL:
case FFI_FASTCALL:
@@ -402,6 +403,7 @@
ecif.rvalue, fn);
break;
#endif
+#endif
default:
FFI_ASSERT(0);
break;
@@ -741,6 +743,7 @@
&ffi_closure_SYSV,
(void*)codeloc);
}
+#ifdef X86_WIN32
else if (cif->abi == FFI_REGISTER)
{
FFI_INIT_TRAMPOLINE_WIN32 (&closure->tramp[0],
@@ -765,7 +768,6 @@
&ffi_closure_STDCALL,
(void*)codeloc);
}
-#ifdef X86_WIN32
else if (cif->abi == FFI_MS_CDECL)
{
FFI_INIT_TRAMPOLINE (&closure->tramp[0],
@@ -909,7 +911,7 @@
case FFI_SYSV:
case FFI_MS_CDECL:
#endif
-#ifndef X86_WIN64
+#ifdef X86_WIN32
case FFI_STDCALL:
case FFI_THISCALL:
case FFI_FASTCALL:
diff -Naur --exclude 'build*' --exclude darwin_ios --exclude '*.swp' ../armv7/libffi-3.2.1/src/x86/win32.S libffi-3.2.1/src/x86/win32.S
--- ../armv7/libffi-3.2.1/src/x86/win32.S 2014-11-11 15:41:37.000000000 +0100
+++ libffi-3.2.1/src/x86/win32.S 2015-02-11 12:33:46.000000000 +0100
@@ -37,8 +37,6 @@
#define CIF_BYTES_OFFSET 16
#define CIF_FLAGS_OFFSET 20
-#ifdef _MSC_VER
-
#define CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) AND NOT 3)
.386
@@ -1344,8 +1342,6 @@
.align 4
.LEFDE5:
-#endif /* !_MSC_VER */
-
#if defined __ELF__ && defined __linux__
.section .note.GNU-stack,"",@progbits
#endif
diff -Naur --exclude 'build*' --exclude darwin_ios --exclude '*.swp' ../armv7/libffi-3.2.1/src/x86/win64.S libffi-3.2.1/src/x86/win64.S
--- ../armv7/libffi-3.2.1/src/x86/win64.S 2014-11-08 13:47:24.000000000 +0100
+++ libffi-3.2.1/src/x86/win64.S 2015-02-11 12:31:27.000000000 +0100
@@ -16,7 +16,6 @@
unsigned *rvalue, void (*fn)());
*/
-#ifdef _MSC_VER
PUBLIC ffi_call_win64
EXTRN __chkstk:NEAR
@@ -516,5 +515,4 @@
pop %rbp
retq
.seh_endproc
-#endif /* !_MSC_VER */

View file

@ -0,0 +1,141 @@
diff -u libffi-3.2.1/libffi.xcodeproj/project.pbxproj libffi-3.2.1-orig/libffi.xcodeproj/project.pbxproj
--- libffi-3.2.1/libffi.xcodeproj/project.pbxproj 2015-10-26 18:06:27.000000000 -0400
+++ libffi-3.2.1-orig/libffi.xcodeproj/project.pbxproj 2014-11-08 07:47:24.000000000 -0500
@@ -7,10 +7,10 @@
objects = {
/* Begin PBXBuildFile section */
- DBFA714A187F1D8600A76262 /* ffi.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA713E187F1D8600A76262 /* ffi.h */; settings = {ATTRIBUTES = (Public, ); }; };
- DBFA714B187F1D8600A76262 /* ffi_common.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA713F187F1D8600A76262 /* ffi_common.h */; settings = {ATTRIBUTES = (Public, ); }; };
- DBFA714C187F1D8600A76262 /* fficonfig.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7140187F1D8600A76262 /* fficonfig.h */; settings = {ATTRIBUTES = (Private, ); }; };
- DBFA714D187F1D8600A76262 /* ffitarget.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7141187F1D8600A76262 /* ffitarget.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ DBFA714A187F1D8600A76262 /* ffi.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA713E187F1D8600A76262 /* ffi.h */; };
+ DBFA714B187F1D8600A76262 /* ffi_common.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA713F187F1D8600A76262 /* ffi_common.h */; };
+ DBFA714C187F1D8600A76262 /* fficonfig.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7140187F1D8600A76262 /* fficonfig.h */; };
+ DBFA714D187F1D8600A76262 /* ffitarget.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7141187F1D8600A76262 /* ffitarget.h */; };
DBFA714E187F1D8600A76262 /* closures.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7143187F1D8600A76262 /* closures.c */; };
DBFA714F187F1D8600A76262 /* closures.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7143187F1D8600A76262 /* closures.c */; };
DBFA7156187F1D8600A76262 /* prep_cif.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7147187F1D8600A76262 /* prep_cif.c */; };
@@ -28,12 +28,12 @@
DBFA717D187F1D9B00A76262 /* darwin_i386.S in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7174187F1D9B00A76262 /* darwin_i386.S */; };
DBFA717E187F1D9B00A76262 /* ffi64_x86_64.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7175187F1D9B00A76262 /* ffi64_x86_64.c */; };
DBFA717F187F1D9B00A76262 /* ffi_i386.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7176187F1D9B00A76262 /* ffi_i386.c */; };
- DBFA718E187F1DA100A76262 /* ffi_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7182187F1DA100A76262 /* ffi_i386.h */; settings = {ATTRIBUTES = (Private, ); }; };
- DBFA718F187F1DA100A76262 /* ffi_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7183187F1DA100A76262 /* ffi_x86_64.h */; settings = {ATTRIBUTES = (Private, ); }; };
- DBFA7190187F1DA100A76262 /* fficonfig_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7184187F1DA100A76262 /* fficonfig_i386.h */; settings = {ATTRIBUTES = (Private, ); }; };
- DBFA7191187F1DA100A76262 /* fficonfig_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7185187F1DA100A76262 /* fficonfig_x86_64.h */; settings = {ATTRIBUTES = (Private, ); }; };
- DBFA7192187F1DA100A76262 /* ffitarget_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7186187F1DA100A76262 /* ffitarget_i386.h */; settings = {ATTRIBUTES = (Private, ); }; };
- DBFA7193187F1DA100A76262 /* ffitarget_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7187187F1DA100A76262 /* ffitarget_x86_64.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ DBFA718E187F1DA100A76262 /* ffi_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7182187F1DA100A76262 /* ffi_i386.h */; };
+ DBFA718F187F1DA100A76262 /* ffi_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7183187F1DA100A76262 /* ffi_x86_64.h */; };
+ DBFA7190187F1DA100A76262 /* fficonfig_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7184187F1DA100A76262 /* fficonfig_i386.h */; };
+ DBFA7191187F1DA100A76262 /* fficonfig_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7185187F1DA100A76262 /* fficonfig_x86_64.h */; };
+ DBFA7192187F1DA100A76262 /* ffitarget_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7186187F1DA100A76262 /* ffitarget_i386.h */; };
+ DBFA7193187F1DA100A76262 /* ffitarget_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7187187F1DA100A76262 /* ffitarget_x86_64.h */; };
DBFA7194187F1DA100A76262 /* darwin64_x86_64.S in Sources */ = {isa = PBXBuildFile; fileRef = DBFA718A187F1DA100A76262 /* darwin64_x86_64.S */; };
DBFA7195187F1DA100A76262 /* darwin_i386.S in Sources */ = {isa = PBXBuildFile; fileRef = DBFA718B187F1DA100A76262 /* darwin_i386.S */; };
DBFA7196187F1DA100A76262 /* ffi64_x86_64.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA718C187F1DA100A76262 /* ffi64_x86_64.c */; };
@@ -123,7 +123,7 @@
DBFA713D187F1D8600A76262 /* include */,
DBFA7142187F1D8600A76262 /* src */,
);
- path = darwin_common;
+ path = "darwin_common";
sourceTree = "<group>";
};
DBFA713D187F1D8600A76262 /* include */ = {
@@ -155,7 +155,7 @@
DBFA715D187F1D9B00A76262 /* include */,
DBFA716A187F1D9B00A76262 /* src */,
);
- path = darwin_ios;
+ path = "darwin_ios";
sourceTree = "<group>";
};
DBFA715D187F1D9B00A76262 /* include */ = {
@@ -223,7 +223,7 @@
DBFA7181187F1DA100A76262 /* include */,
DBFA7188187F1DA100A76262 /* src */,
);
- path = darwin_osx;
+ path = "darwin_osx";
sourceTree = "<group>";
};
DBFA7181187F1DA100A76262 /* include */ = {
@@ -265,16 +265,16 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
- DBFA714A187F1D8600A76262 /* ffi.h in Headers */,
+ DBFA714C187F1D8600A76262 /* fficonfig.h in Headers */,
DBFA714D187F1D8600A76262 /* ffitarget.h in Headers */,
- DBFA714B187F1D8600A76262 /* ffi_common.h in Headers */,
+ DBFA714A187F1D8600A76262 /* ffi.h in Headers */,
DBFA718F187F1DA100A76262 /* ffi_x86_64.h in Headers */,
- DBFA718E187F1DA100A76262 /* ffi_i386.h in Headers */,
- DBFA7192187F1DA100A76262 /* ffitarget_i386.h in Headers */,
- DBFA7193187F1DA100A76262 /* ffitarget_x86_64.h in Headers */,
- DBFA714C187F1D8600A76262 /* fficonfig.h in Headers */,
DBFA7191187F1DA100A76262 /* fficonfig_x86_64.h in Headers */,
+ DBFA718E187F1DA100A76262 /* ffi_i386.h in Headers */,
DBFA7190187F1DA100A76262 /* fficonfig_i386.h in Headers */,
+ DBFA714B187F1D8600A76262 /* ffi_common.h in Headers */,
+ DBFA7193187F1DA100A76262 /* ffitarget_x86_64.h in Headers */,
+ DBFA7192187F1DA100A76262 /* ffitarget_i386.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -414,7 +414,7 @@
buildSettings = {
HEADER_SEARCH_PATHS = (
"$(inherited)",
- darwin_common/include,
+ "darwin_common/include",
);
ONLY_ACTIVE_ARCH = YES;
};
@@ -425,7 +425,7 @@
buildSettings = {
HEADER_SEARCH_PATHS = (
"$(inherited)",
- darwin_common/include,
+ "darwin_common/include",
);
};
name = Release;
@@ -465,7 +465,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
- darwin_ios/include,
+ "darwin_ios/include",
);
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
"IPHONEOS_DEPLOYMENT_TARGET[arch=arm64]" = 7.0;
@@ -505,7 +505,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
- darwin_ios/include,
+ "darwin_ios/include",
);
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
"IPHONEOS_DEPLOYMENT_TARGET[arch=arm64]" = 7.0;
@@ -552,7 +552,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
- darwin_osx/include,
+ "darwin_osx/include",
);
MACOSX_DEPLOYMENT_TARGET = 10.6;
ONLY_ACTIVE_ARCH = YES;
@@ -592,7 +592,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
- darwin_osx/include,
+ "darwin_osx/include",
);
MACOSX_DEPLOYMENT_TARGET = 10.6;
OTHER_LDFLAGS = "-Wl,-no_compact_unwind";

View file

@ -0,0 +1,18 @@
--- libffi-3.2.1/libffi.xcodeproj/project.pbxproj 2015-10-26 18:32:03.000000000 -0400
+++ libffi-3.2.1-orig/libffi.xcodeproj/project.pbxproj 2015-10-26 18:10:09.000000000 -0400
@@ -554,7 +554,6 @@
"$(inherited)",
darwin_osx/include,
);
- MACH_O_TYPE = staticlib;
MACOSX_DEPLOYMENT_TARGET = 10.6;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-Wl,-no_compact_unwind";
@@ -595,7 +594,6 @@
"$(inherited)",
darwin_osx/include,
);
- MACH_O_TYPE = staticlib;
MACOSX_DEPLOYMENT_TARGET = 10.6;
OTHER_LDFLAGS = "-Wl,-no_compact_unwind";
PRODUCT_NAME = ffi;

View file

@ -0,0 +1,66 @@
diff -u libffi-3.2.1/libffi.xcodeproj/project.pbxproj libffi-3.2.1-orig/libffi.xcodeproj/project.pbxproj
--- libffi-3.2.1/libffi.xcodeproj/project.pbxproj 2015-10-26 20:02:36.000000000 -0400
+++ libffi-3.2.1-orig/libffi.xcodeproj/project.pbxproj 2015-10-26 19:41:01.000000000 -0400
@@ -54,7 +54,7 @@
/* Begin PBXFileReference section */
DB13B1661849DF1E0010F42D /* libffi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libffi.a; sourceTree = BUILT_PRODUCTS_DIR; };
- DB13B1911849DF510010F42D /* libffi.a */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libffi.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ DB13B1911849DF510010F42D /* ffi.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = ffi.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
DBFA713E187F1D8600A76262 /* ffi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi.h; sourceTree = "<group>"; };
DBFA713F187F1D8600A76262 /* ffi_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_common.h; sourceTree = "<group>"; };
DBFA7140187F1D8600A76262 /* fficonfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig.h; sourceTree = "<group>"; };
@@ -112,7 +112,7 @@
isa = PBXGroup;
children = (
DB13B1661849DF1E0010F42D /* libffi.a */,
- DB13B1911849DF510010F42D /* libffi.a */,
+ DB13B1911849DF510010F42D /* ffi.dylib */,
);
name = Products;
sourceTree = "<group>";
@@ -312,7 +312,7 @@
);
name = "libffi-Mac";
productName = ffi;
- productReference = DB13B1911849DF510010F42D /* libffi.a */;
+ productReference = DB13B1911849DF510010F42D /* ffi.dylib */;
productType = "com.apple.product-type.library.dynamic";
};
/* End PBXNativeTarget section */
@@ -535,7 +535,6 @@
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
- EXECUTABLE_EXTENSION = a;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
@@ -559,7 +558,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.6;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-Wl,-no_compact_unwind";
- PRODUCT_NAME = libffi;
+ PRODUCT_NAME = ffi;
SDKROOT = macosx;
};
name = Debug;
@@ -584,7 +583,6 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
ENABLE_NS_ASSERTIONS = NO;
- EXECUTABLE_EXTENSION = a;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -600,7 +598,7 @@
MACH_O_TYPE = staticlib;
MACOSX_DEPLOYMENT_TARGET = 10.6;
OTHER_LDFLAGS = "-Wl,-no_compact_unwind";
- PRODUCT_NAME = libffi;
+ PRODUCT_NAME = ffi;
SDKROOT = macosx;
};
name = Release;
Only in libffi-3.2.1/libffi.xcodeproj: project.xcworkspace
Only in libffi-3.2.1/libffi.xcodeproj: xcuserdata

View file

@ -8,8 +8,8 @@ import shutil
class HostpythonRecipe(Recipe):
version = "2.7.1"
url = "https://www.python.org/ftp/python/{version}/Python-{version}.tar.bz2"
depends = ["libffi", ]
archs = ["i386"]
depends = ["hostlibffi", ]
archs = ["x86_64"]
def init_with_ctx(self, ctx):
super(HostpythonRecipe, self).init_with_ctx(ctx)
@ -45,18 +45,18 @@ class HostpythonRecipe(Recipe):
with open(makefile_fn, "w") as fd:
fd.writelines(lines)
def build_i386(self):
def build_x86_64(self):
sdk_path = sh.xcrun("--sdk", "macosx", "--show-sdk-path").strip()
build_env = self.ctx.env.copy()
build_env["CC"] = "clang -Qunused-arguments -fcolor-diagnostics"
build_env["LDFLAGS"] = " ".join([
"-lsqlite3",
"-lffi",
"-L{}".format(join(self.ctx.dist_dir, "lib"))
"-L{}".format(join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "lib"))
])
build_env["CFLAGS"] = " ".join([
"--sysroot={}".format(sdk_path),
"-I{}".format(join(self.ctx.dist_dir, "include", "i386", "libffi"))
"-I{}".format(join(self.ctx.dist_dir, "hostlibffi", "usr", "local", "include"))
])
configure = sh.Command(join(self.build_dir, "configure"))
shprint(configure,

View file

@ -1,7 +1,6 @@
from toolchain import Recipe, shprint
from os.path import join, exists
from os.path import join
import sh
import os
arch_mapper = {'i386': 'darwin-i386-cc',
@ -11,7 +10,7 @@ arch_mapper = {'i386': 'darwin-i386-cc',
class OpensslRecipe(Recipe):
version = "1.0.2d"
version = "1.0.2f"
url = "http://www.openssl.org/source/openssl-{version}.tar.gz"
libraries = ["libssl.a", "libcrypto.a"]
include_dir = "include"

View file

@ -0,0 +1,16 @@
from toolchain import CythonRecipe
class PhotoRecipe(CythonRecipe):
version = "master"
url = "https://github.com/akshayaurora/photolibrary/archive/master.zip"
library = "libphotolibrary.a"
depends = ["python"]
pbx_frameworks = ["UIKit", "Photos", "MobileCoreServices"]
def install(self):
self.install_python_package(name="photolibrary.so", is_dir=False)
recipe = PhotoRecipe()

View file

@ -0,0 +1,45 @@
'''Recipe for pycrypto on ios
'''
from toolchain import CythonRecipe, shprint
from os.path import join, exists
import sh
import os
class PycryptoRecipe(CythonRecipe):
version = "2.6.1"
url = "https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-{version}.tar.gz"
depends = ["python", "openssl"]
include_per_arch = True
library="libpycrypto.a"
def build_arch(self, arch):
build_env = arch.get_env()
self.apply_patch('hash_SHA2_template.c.patch', target_dir=self.build_dir + '/src')
configure = sh.Command(join(self.build_dir, "configure"))
shprint(configure,
"CC={}".format(build_env["CC"]),
"LD={}".format(build_env["LD"]),
"CFLAGS={}".format(build_env["CFLAGS"]),
"LDFLAGS={} -Wno-error ".format(build_env["LDFLAGS"]),
"--prefix=/",
"--host={}".format(arch),
"ac_cv_func_malloc_0_nonnull=yes",
"ac_cv_func_realloc_0_nonnull=yes",
)
hostpython = sh.Command(self.ctx.hostpython)
super(PycryptoRecipe, self).build_arch(arch)
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
hostpython = sh.Command(self.ctx.hostpython)
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
shprint(hostpython, "setup.py", "install", "--prefix", dest_dir, _env=build_env)
recipe = PycryptoRecipe()

View file

@ -0,0 +1,11 @@
--- ../src/src/hash_SHA2_template.c 2015-07-15 15:25:59.000000000 +0530
+++ src/hash_SHA2_template.c 2015-07-17 15:35:13.000000000 +0530
@@ -87,7 +87,7 @@
* return 1 on success
* return 0 if the length overflows
*/
-static int add_length(hash_state *hs, sha2_word_t inc) {
+int add_length(hash_state *hs, sha2_word_t inc) {
sha2_word_t overflow_detector;
overflow_detector = hs->length_lower;
hs->length_lower += inc;

View file

@ -23,6 +23,7 @@ datetime datetimemodule.c # date/time type
_bisect _bisectmodule.c # Bisection algorithms
fcntl fcntlmodule.c # fcntl(2) and ioctl(2)
select selectmodule.c # select(2); not on ancient System V
_csv _csv.c
_socket socketmodule.c
_md5 md5module.c md5.c
_sha shamodule.c
@ -51,4 +52,3 @@ pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Mo
# Future (used by numpy)
future_builtins future_builtins.c
_ssl _ssl.c -DUSE_SSL -lssl -lcrypto

View file

@ -0,0 +1 @@
_ssl _ssl.c -DUSE_SSL -lssl -lcrypto

View file

@ -8,6 +8,7 @@ class PythonRecipe(Recipe):
version = "2.7.1"
url = "https://www.python.org/ftp/python/{version}/Python-{version}.tar.bz2"
depends = ["hostpython", "libffi", ]
optional_depends = ["openssl"]
library = "libpython2.7.a"
pbx_libraries = ["libz", "libbz2", "libsqlite3"]
@ -30,6 +31,8 @@ class PythonRecipe(Recipe):
self.apply_patch("xcompile.patch")
self.apply_patch("setuppath.patch")
self.append_file("ModulesSetup.mobile", "Modules/Setup.local")
if "openssl.build_all" in self.ctx.state:
self.append_file("ModulesSetup.openssl", "Modules/Setup.local")
self.set_marker("patched")
@ -40,7 +43,7 @@ class PythonRecipe(Recipe):
"CC={}".format(build_env["CC"]),
"LD={}".format(build_env["LD"]),
"CFLAGS={}".format(build_env["CFLAGS"]),
"LDFLAGS={}".format(build_env["LDFLAGS"]),
"LDFLAGS={} -undefined dynamic_lookup".format(build_env["LDFLAGS"]),
"--without-pymalloc",
"--disable-toolbox-glue",
"--host={}-apple-darwin".format(arch),

View file

@ -12,6 +12,12 @@ class LibSDL2Recipe(Recipe):
pbx_frameworks = ["OpenGLES", "AudioToolbox", "QuartzCore", "CoreGraphics",
"CoreMotion"]
def prebuild_arch(self, arch):
if self.has_marker("patched"):
return
self.apply_patch("uikit-transparent.patch")
self.set_marker("patched")
def build_arch(self, arch):
shprint(sh.xcodebuild,
"ONLY_ACTIVE_ARCH=NO",

View file

@ -0,0 +1,11 @@
--- slime73-sdl-experiments-618662dc9e82/src/video/uikit/SDL_uikitopenglview.m.orig 2015-08-20 16:09:59.000000000 +0200
+++ slime73-sdl-experiments-618662dc9e82/src/video/uikit/SDL_uikitopenglview.m 2015-08-20 16:11:25.000000000 +0200
@@ -99,7 +99,7 @@
CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
- eaglLayer.opaque = YES;
+ eaglLayer.opaque = SDL_getenv("UIKIT_TRANSPARENT") ? NO : YES;
eaglLayer.drawableProperties = @{
kEAGLDrawablePropertyRetainedBacking:@(retained),
kEAGLDrawablePropertyColorFormat:colorFormat

View file

@ -9,7 +9,7 @@ This tool intend to replace all the previous tools/ in shell script.
import sys
from sys import stdout
from os.path import join, dirname, realpath, exists, isdir, basename
from os import listdir, unlink, makedirs, environ, chdir, getcwd, walk
from os import listdir, unlink, makedirs, environ, chdir, getcwd, walk, remove
import zipfile
import tarfile
import importlib
@ -164,7 +164,6 @@ class Arch(object):
"--sysroot", self.sysroot,
"-L{}/{}".format(self.ctx.dist_dir, "lib"),
"-lsqlite3",
"-undefined", "dynamic_lookup",
self.version_min
])
return env
@ -353,6 +352,7 @@ class Recipe(object):
url = None
archs = []
depends = []
optional_depends = []
library = None
libraries = []
include_dir = None
@ -401,9 +401,7 @@ class Recipe(object):
shprint(sh.tar, "-C", cwd, "-xvjf", filename)
elif filename.endswith(".zip"):
zf = zipfile.ZipFile(filename)
zf.extractall(path=cwd)
zf.close()
shprint(sh.unzip, "-d", cwd, filename)
else:
print("Error: cannot extract, unreconized extension for {}".format(
@ -412,8 +410,16 @@ class Recipe(object):
def get_archive_rootdir(self, filename):
if filename.endswith(".tgz") or filename.endswith(".tar.gz") or \
filename.endswith(".tbz2") or filename.endswith(".tar.bz2"):
archive = tarfile.open(filename)
filename.endswith(".tbz2") or filename.endswith(".tar.bz2"):
try:
archive = tarfile.open(filename)
except tarfile.ReadError:
print('Error extracting the archive {0}'.format(filename))
print('This is usually caused by a corrupt download. The file'
' will be removed and re-downloaded on the next run.')
remove(filename)
return
root = archive.next().path.split("/")
return root[0]
elif filename.endswith(".zip"):
@ -424,14 +430,15 @@ class Recipe(object):
print("Unrecognized extension for {}".format(filename))
raise Exception()
def apply_patch(self, filename):
def apply_patch(self, filename, target_dir=''):
"""
Apply a patch from the current recipe directory into the current
build directory.
"""
target_dir = target_dir or self.build_dir
print("Apply patch {}".format(filename))
filename = join(self.recipe_dir, filename)
sh.patch("-t", "-d", self.build_dir, "-p1", "-i", filename)
sh.patch("-t", "-d", target_dir, "-p1", "-i", filename)
def copy_file(self, filename, dest):
print("Copy {} to {}".format(filename, dest))
@ -525,7 +532,7 @@ class Recipe(object):
else:
include_dir = join("common", self.name)
if include_dir:
#print("Include dir added: {}".format(include_dir))
print("Include dir added: {}".format(include_dir))
self.ctx.include_dirs.append(include_dir)
def get_recipe_env(self, arch=None):
@ -556,11 +563,12 @@ class Recipe(object):
"""Check if there is a variable name to specify a custom version /
directory to use instead of the current url.
"""
d = environ.get("{}_DIR".format(self.name.upper()))
envname = "{}_DIR".format(self.name.upper())
d = environ.get(envname)
if not d:
return
if not exists(d):
return
raise ValueError("Invalid path passed into {}".format(envname))
return d
@cache_execution
@ -903,10 +911,20 @@ def build_recipes(names, ctx):
print("ERROR: No recipe named {}".format(name))
sys.exit(1)
graph.add(name, name)
print("Loaded recipe {} (depends of {})".format(name, recipe.depends))
print("Loaded recipe {} (depends of {}, optional are {})".format(name,
recipe.depends, recipe.optional_depends))
for depend in recipe.depends:
graph.add(name, depend)
recipe_to_load += recipe.depends
for depend in recipe.optional_depends:
# in case of compilation after the initial one, take in account
# of the already compiled recipes
key = "{}.build_all".format(depend)
if key in ctx.state:
recipe_to_load.append(name)
graph.add(name, depend)
else:
graph.add_optional(name, depend)
recipe_loaded.append(name)
build_order = list(graph.find_order())
@ -1013,6 +1031,8 @@ Available commands:
Xcode:
create Create a new xcode project
update Update an existing xcode project (frameworks, libraries..)
launchimage Create Launch images for your xcode project
icon Create Icons for your xcode project
""")
parser.add_argument("command", help="Command to run")
args = parser.parse_args(sys.argv[1:2])
@ -1026,12 +1046,22 @@ Xcode:
parser = argparse.ArgumentParser(
description="Build the toolchain")
parser.add_argument("recipe", nargs="+", help="Recipe to compile")
parser.add_argument("--arch", help="Restrict compilation to this arch")
parser.add_argument("--arch", action="append",
help="Restrict compilation to this arch")
args = parser.parse_args(sys.argv[2:])
ctx = Context()
if args.arch:
archs = args.arch.split()
if len(args.arch) == 1:
archs = args.arch[0].split()
else:
archs = args.arch
available_archs = [arch.arch for arch in ctx.archs]
for arch in archs[:]:
if arch not in available_archs:
print("ERROR: Architecture {} invalid".format(arch))
archs.remove(arch)
continue
ctx.archs = [arch for arch in ctx.archs if arch.arch in archs]
print("Architectures restricted to: {}".format(archs))
build_recipes(args.recipe, ctx)
@ -1136,7 +1166,6 @@ Xcode:
parser.add_argument("filename", help="Path to your project or xcodeproj")
args = parser.parse_args(sys.argv[2:])
filename = args.filename
if not filename.endswith(".xcodeproj"):
# try to find the xcodeproj
@ -1156,5 +1185,43 @@ Xcode:
print("--")
print("Project {} updated".format(filename))
def launchimage(self):
import xcassets
self._xcassets("LaunchImage", xcassets.launchimage)
def icon(self):
import xcassets
self._xcassets("Icon", xcassets.icon)
def _xcassets(self, title, command):
parser = argparse.ArgumentParser(
description="Generate {} for your project".format(title))
parser.add_argument("filename", help="Path to your project or xcodeproj")
parser.add_argument("image", help="Path to your initial {}.png".format(title.lower()))
args = parser.parse_args(sys.argv[2:])
if not exists(args.image):
print("ERROR: image path does not exists.")
return
filename = args.filename
if not filename.endswith(".xcodeproj"):
# try to find the xcodeproj
from glob import glob
xcodeproj = glob(join(filename, "*.xcodeproj"))
if not xcodeproj:
print("ERROR: Unable to find a xcodeproj in {}".format(filename))
sys.exit(1)
filename = xcodeproj[0]
project_name = filename.split("/")[-1].replace(".xcodeproj", "")
images_xcassets = realpath(join(filename, "..", project_name,
"Images.xcassets"))
if not exists(images_xcassets):
print("WARNING: Images.xcassets not found, creating it.")
makedirs(images_xcassets)
print("Images.xcassets located at {}".format(images_xcassets))
command(images_xcassets, args.image)
ToolchainCL()

596
tools/external/xcassets.py vendored Normal file
View file

@ -0,0 +1,596 @@
"""
Icon and LaunchImage generator for iOS
======================================
.. author:: Mathieu Virbel <mat@meltingrocks.com>
"""
__all__ = ["launchimage"]
import sh
import json
from os.path import join, exists
from os import makedirs
appicon_json = {
"images" : [
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon29.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon58.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon87.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon80.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon120.png",
"scale" : "3x"
},
{
"size" : "57x57",
"idiom" : "iphone",
"filename" : "Icon57.png",
"scale" : "1x"
},
{
"size" : "57x57",
"idiom" : "iphone",
"filename" : "Icon114.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon120.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon180.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon29.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon58.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon40.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon80.png",
"scale" : "2x"
},
{
"size" : "50x50",
"idiom" : "ipad",
"filename" : "Icon50.png",
"scale" : "1x"
},
{
"size" : "50x50",
"idiom" : "ipad",
"filename" : "Icon100.png",
"scale" : "2x"
},
{
"size" : "72x72",
"idiom" : "ipad",
"filename" : "Icon72.png",
"scale" : "1x"
},
{
"size" : "72x72",
"idiom" : "ipad",
"filename" : "Icon144.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon76.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon152.png",
"scale" : "2x"
},
# If activated, we got a submission error:
# "Error ITMS-9000: Invalid Image Path - No image found at the path
# referenced under key 'CFBundleIcons': 'AppIcon120x120'"
# {
# "size" : "120x120",
# "idiom" : "car",
# "filename" : "Icon120.png",
# "scale" : "1x"
# },
{
"size" : "24x24",
"idiom" : "watch",
"scale" : "2x",
"filename" : "Icon48.png",
"role" : "notificationCenter",
"subtype" : "38mm"
},
{
"size" : "27.5x27.5",
"idiom" : "watch",
"scale" : "2x",
"filename" : "Icon55.png",
"role" : "notificationCenter",
"subtype" : "42mm"
},
{
"size" : "29x29",
"idiom" : "watch",
"filename" : "Icon58.png",
"role" : "companionSettings",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "watch",
"filename" : "Icon87.png",
"role" : "companionSettings",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "watch",
"scale" : "2x",
"filename" : "Icon80.png",
"role" : "appLauncher",
"subtype" : "38mm"
},
{
"size" : "44x44",
"idiom" : "watch",
"scale" : "2x",
"filename" : "Icon88.png",
"role" : "longLook",
"subtype" : "42mm"
},
{
"size" : "86x86",
"idiom" : "watch",
"scale" : "2x",
"filename" : "Icon172.png",
"role" : "quickLook",
"subtype" : "38mm"
},
{
"size" : "98x98",
"idiom" : "watch",
"scale" : "2x",
"filename" : "Icon196.png",
"role" : "quickLook",
"subtype" : "42mm"
},
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "Icon16.png",
"scale" : "1x"
},
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "Icon32.png",
"scale" : "2x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "Icon32.png",
"scale" : "1x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "Icon64.png",
"scale" : "2x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "Icon128.png",
"scale" : "1x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "Icon256.png",
"scale" : "2x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "Icon256.png",
"scale" : "1x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "Icon512.png",
"scale" : "2x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "Icon512.png",
"scale" : "1x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "Icon1024.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
# "properties" : {
# "pre-rendered" : True
# }
}
launchimage_json = {
"images" : [
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "736h",
"filename" : "Default1242x2208.png",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "3x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "736h",
"filename" : "Default2208x1242.png",
"minimum-system-version" : "8.0",
"orientation" : "landscape",
"scale" : "3x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "667h",
"filename" : "Default750x1334.png",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"filename" : "Default640x960.png",
"scale" : "2x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "retina4",
"filename" : "Default640x1136.png",
"minimum-system-version" : "7.0",
"orientation" : "portrait",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"filename" : "Default768x1024.png",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"filename" : "Default1024x768.png",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"filename" : "Default1536x2048.png",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"filename" : "Default2048x1536.png",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"filename" : "Default320x480.png",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"filename" : "Default640x960.png",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"filename" : "Default640x1136.png",
"subtype" : "retina4",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"filename" : "Default768x1024.png",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"filename" : "Default1024x768.png",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"filename" : "Default1536x2048.png",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"filename" : "Default2048x1536.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
def icon(image_xcassets, image_fn):
"""Generate all the possible Icon from a single image_fn
"""
appicon_dir = join(image_xcassets, "AppIcon.appiconset")
if not exists(appicon_dir):
makedirs(appicon_dir)
with open(join(appicon_dir, "Contents.json"), "w") as fd:
json.dump(appicon_json, fd)
options = (
# iPhone
# Spotlight - iOS 5,6
# Settings - iOS 5-8
# 29pt - 1x,2x,3x
("87", None, "Icon87.png"),
("58", None, "Icon58.png"),
("29", "Icon58.png", "Icon29.png"),
# iPhone
# Spotlight - iOS 7-8
# 40pt 2x,3x
("120", None, "Icon120.png"),
("80", None, "Icon80.png"),
# iPhone
# App - iOS 5,6
# 57pt 1x,2x
("114", None, "Icon114.png"),
("57", "Icon114.png", "Icon57.png"),
# iPhone
# App - iOS 7,8
# 60pt 2x,3x
("180", None, "Icon180.png"),
#("120", None, "Icon120.png # duplicate"),
# iPad
# Settings iOS 5-8
#("58", None, "Icon58.png # duplicate"),
#("29", "Icon58.png", "Icon29.png # duplicate"),
# iPad
# Spotlight iOS 7,8
# 40pt 1x,2x
#("80", None, "Icon80.png # duplicate"),
("40", "Icon80.png", "Icon40.png"),
# iPad
# Spotlight iOS 5,6
# 50pt 1x,2x
("100", None, "Icon100.png"),
("50", "Icon100.png", "Icon50.png"),
# iPad
# App iOS 5,6
# 72pt 1x,2x
("144", None, "Icon144.png"),
("72", "Icon144.png", "Icon72.png"),
# iPad
# App iOS 7,8
# 76pt 1x,2x
("152", None, "Icon152.png"),
("76", "Icon152.png", "Icon76.png"),
# CarPlay
# App iOS 8
# 120pt 1x
#("120", None, "Icon120.png # duplicate"),
# Apple Watch
# Notification Center
# 38mm, 42mm
("48", None, "Icon48.png"),
("55", None, "Icon55.png"),
# Apple Watch
# Companion Settings
# 29pt 2x,3x
#("58", None, "Icon58.png # duplicate"),
#("87", None, "Icon87.png # duplicate"),
# Apple Watch
# Home Screen (All)
# Long Look (38mm)
#("80", None, "Icon80.png # duplicate"),
# Apple Watch
# Long Look (42mm)
("88", None, "Icon88.png"),
# Apple Watch
# Short Look
# 38mm, 42mm
("172", None, "Icon172.png"),
("196", None, "Icon196.png"),
# OS X
# 512pt 1x,2x
("1024", None, "Icon1024.png"),
("512", "Icon1024.png", "Icon512.png"),
# OS X
# 256pt 1x,2x
#("512", "Icon1024.png", "Icon512.png # duplicate"),
("256", "Icon512.png", "Icon256.png"),
# OS X
# 128pt 1x,2x
#("256", "Icon512.png", "Icon256.png # duplicate"),
("128", "Icon256.png", "Icon128.png"),
# OS X
# 32pt 1x,2x
("64", "Icon128.png", "Icon64.png"),
("32", "Icon64.png", "Icon32.png"),
# OS X
# 16pt 1x,2x
#("32", "Icon64.png", "Icon32.png # duplicate"),
("16", "Icon32.png", "Icon16.png"))
_generate("AppIcon.appiconset", image_xcassets, image_fn, options, icon=True)
def launchimage(image_xcassets, image_fn):
"""Generate all the possible Launch Images from a single image_fn
"""
launchimage_dir = join(image_xcassets, "LaunchImage.launchimage")
if not exists(launchimage_dir):
makedirs(launchimage_dir)
with open(join(launchimage_dir, "Contents.json"), "w") as fd:
json.dump(launchimage_json, fd)
options = (
# size, input, output
# iPhone 3.5" @2x
("640 960", None, "Default640x960.png"),
# iPhone 3.5" @1x
("320 480", "Default640x960.png", "Default320x480.png"),
# iPhone 4.0" @2x
("640 1136", None, "Default640x1136.png"),
# iPhone 5.5" @3x - landscape
("2208 1242", None, "Default2208x1242.png"),
# iPhone 5.5" @3x - portrait
("1242 2208", "Default2208x1242.png", "Default1242x2208.png"),
# iPhone 4.7" @2x
("750 1334", None, "Default750x1334.png"),
# iPad @2x - landscape
("2048 1536", None, "Default2048x1536.png"),
# iPad @2x - portrait
("1536 2048", "Default2048x1536.png", "Default1536x2048.png"),
# iPad @1x - landscape
("1024 768", "Default2048x1536.png", "Default1024x768.png"),
# iPad @1x - portrait
("768 1024", "Default1024x768.png", "Default768x1024.png"),
)
_generate("LaunchImage.launchimage", image_xcassets, image_fn, options)
def _generate(d, image_xcassets, image_fn, options, icon=False):
for c, in_fn, out_fn in options:
args = []
if icon:
args += ["-Z", c]
else:
# ensure one side will not be bigger than the other (ie, the image will
# fit to the screen)
args += ["-Z", str(min(map(int, c.split())))]
# if there is any left pixel, cover in black.
args += ["-p"] + c.split()
# and crop the image in necessary.
args += ["-c"] + c.split()[::-1]
if in_fn is not None:
args += [join(image_xcassets, d, in_fn)]
else:
args += [image_fn]
args += [
"--out",
join(image_xcassets, d, out_fn)
]
print "sips", " ".join(args)
sh.sips(*args)

View file

@ -76,4 +76,4 @@ f.close()
print('Liblink redirect linking with', objects)
ld = environ.get('ARM_LD')
arch = environ.get('ARCH', 'armv7')
subprocess.call([ld, '-r', '-o', output + '.o', '-arch', arch] + objects)
subprocess.call([ld, '-r', '-o', output + '.o', '-ios_version_min', '7.0', '-arch', arch] + objects)

View file

@ -276,6 +276,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_RESOURCE_RULES_PATH = "$(SDKROOT)/ResourceRules.plist";
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = "{{ cookiecutter.dist_dir }}/frameworks";
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@ -313,6 +314,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_RESOURCE_RULES_PATH = "$(SDKROOT)/ResourceRules.plist";
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = "{{ cookiecutter.dist_dir }}/frameworks";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;