summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2013-09-03 13:17:13 +0200
committerTor Andersson <tor.andersson@artifex.com>2013-09-08 08:21:19 -0500
commit3408b6a59145df4389f38ba75e095c39bc1c699e (patch)
tree37a8079e8697c8f4ed67e2c50f553c4788c882d4
parentf9f374998eb8208d300bd71bde28fdcd155f5062 (diff)
downloadmupdf-3408b6a59145df4389f38ba75e095c39bc1c699e.tar.xz
ios: Clean up project file.
Strip stupid project build settings. Add proper "make generate" target that uses the 'macosx' sdkroot. Rewrite cross compile build script to be more future proof.
-rw-r--r--Makerules19
-rw-r--r--platform/ios/MuPDF.xcodeproj/project.pbxproj115
-rw-r--r--platform/ios/build_libs.sh34
3 files changed, 90 insertions, 78 deletions
diff --git a/Makerules b/Makerules
index a99942d9..6f7b3f28 100644
--- a/Makerules
+++ b/Makerules
@@ -3,6 +3,7 @@
OS ?= $(shell uname)
OS := $(OS:MINGW%=MINGW)
OS := $(OS:Windows_NT=MINGW)
+OS := $(OS:Darwin=MACOS)
CFLAGS += -Wall
@@ -29,7 +30,7 @@ ifeq "$(OS)" "MINGW"
NOX11 ?= yes
# Mac OS X doesn't have pkg-config so we hard code paths.
-else ifeq "$(OS)" "Darwin"
+else ifeq "$(OS)" "MACOS"
SYS_OPENSSL_CFLAGS = -DHAVE_OPENSSL
SYS_OPENSSL_LIBS = -lcrypto
@@ -45,10 +46,13 @@ SYS_JBIG2DEC_LIBS = -ljbig2dec
SYS_JPEG_LIBS = -ljpeg
SYS_ZLIB_LIBS = -lz
-RANLIB_CMD = ranlib $@
+CC = xcrun cc
+AR = xcrun ar
+LD = xcrun ld
+RANLIB_CMD = xcrun ranlib $@
-# Other Unixes use pkg-config for system libraries.
-else
+# Linux uses pkg-config for system libraries.
+else ifeq "$(OS)" "Linux"
ifeq "$(shell pkg-config --exists libcrypto && echo yes)" "yes"
SYS_OPENSSL_CFLAGS = -DHAVE_OPENSSL $(shell pkg-config --cflags libcrypto)
@@ -126,9 +130,10 @@ endif
# The following section works for both device and simulator builds.
ifeq "$(OS)" "ios"
-CC = $(PLATFORM_DEVELOPER_BIN_DIR)/gcc
-AR = $(PLATFORM_DEVELOPER_BIN_DIR)/ar
-RANLIB_CMD = $(PLATFORM_DEVELOPER_BIN_DIR)/ranlib $@
+CC = xcrun cc
+AR = xcrun ar
+LD = xcrun ld
+RANLIB_CMD = xcrun ranlib $@
CROSSCOMPILE=yes
endif
diff --git a/platform/ios/MuPDF.xcodeproj/project.pbxproj b/platform/ios/MuPDF.xcodeproj/project.pbxproj
index fa2df18b..aa39e9db 100644
--- a/platform/ios/MuPDF.xcodeproj/project.pbxproj
+++ b/platform/ios/MuPDF.xcodeproj/project.pbxproj
@@ -30,6 +30,16 @@
96E1CDF41779A60700FCF717 /* x_alt_blue@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 96E1CDED1779A60700FCF717 /* x_alt_blue@2x.png */; };
/* End PBXBuildFile section */
+/* Begin PBXContainerItemProxy section */
+ 963AD8CF17D60084000B0779 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 968E1E351779A54F0050CEA3 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 963AD8CB17D5FFD9000B0779;
+ remoteInfo = Generate;
+ };
+/* End PBXContainerItemProxy section */
+
/* Begin PBXFileReference section */
968E1E3D1779A54F0050CEA3 /* MuPDF.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MuPDF.app; sourceTree = BUILT_PRODUCTS_DIR; };
968E1E401779A54F0050CEA3 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
@@ -132,6 +142,23 @@
};
/* End PBXGroup section */
+/* Begin PBXLegacyTarget section */
+ 963AD8CB17D5FFD9000B0779 /* Generate */ = {
+ isa = PBXLegacyTarget;
+ buildArgumentsString = generate;
+ buildConfigurationList = 963AD8CE17D5FFD9000B0779 /* Build configuration list for PBXLegacyTarget "Generate" */;
+ buildPhases = (
+ );
+ buildToolPath = /usr/bin/make;
+ buildWorkingDirectory = ../..;
+ dependencies = (
+ );
+ name = Generate;
+ passBuildSettingsInEnvironment = 1;
+ productName = Generate;
+ };
+/* End PBXLegacyTarget section */
+
/* Begin PBXNativeTarget section */
968E1E3C1779A54F0050CEA3 /* MuPDF */ = {
isa = PBXNativeTarget;
@@ -145,6 +172,7 @@
buildRules = (
);
dependencies = (
+ 963AD8D017D60084000B0779 /* PBXTargetDependency */,
);
name = MuPDF;
productName = MuPDF;
@@ -173,6 +201,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
+ 963AD8CB17D5FFD9000B0779 /* Generate */,
968E1E3C1779A54F0050CEA3 /* MuPDF */,
);
};
@@ -232,60 +261,40 @@
};
/* End PBXSourcesBuildPhase section */
+/* Begin PBXTargetDependency section */
+ 963AD8D017D60084000B0779 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 963AD8CB17D5FFD9000B0779 /* Generate */;
+ targetProxy = 963AD8CF17D60084000B0779 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
/* Begin XCBuildConfiguration section */
+ 963AD8CC17D5FFD9000B0779 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SDKROOT = macosx;
+ };
+ name = Debug;
+ };
+ 963AD8CD17D5FFD9000B0779 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SDKROOT = macosx;
+ };
+ name = Release;
+ };
968E1E581779A54F0050CEA3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- COPY_PHASE_STRIP = NO;
- GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PREPROCESSOR_DEFINITIONS = (
- "DEBUG=1",
- "$(inherited)",
- );
- GCC_SYMBOLS_PRIVATE_EXTERN = NO;
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 6.1;
- ONLY_ACTIVE_ARCH = YES;
- SDKROOT = iphoneos;
- TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
968E1E591779A54F0050CEA3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- COPY_PHASE_STRIP = YES;
- GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 6.1;
- OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
- SDKROOT = iphoneos;
- TARGETED_DEVICE_FAMILY = "1,2";
- VALIDATE_PRODUCT = YES;
};
name = Release;
};
@@ -293,12 +302,9 @@
isa = XCBuildConfiguration;
buildSettings = {
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
- IPHONEOS_DEPLOYMENT_TARGET = 5.0;
- LIBRARY_SEARCH_PATHS = "$(inherited)";
PRODUCT_NAME = "$(TARGET_NAME)";
- TARGETED_DEVICE_FAMILY = "1,2";
+ SDKROOT = iphoneos;
USER_HEADER_SEARCH_PATHS = ../../include;
- WRAPPER_EXTENSION = app;
};
name = Debug;
};
@@ -306,18 +312,23 @@
isa = XCBuildConfiguration;
buildSettings = {
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
- IPHONEOS_DEPLOYMENT_TARGET = 5.0;
- LIBRARY_SEARCH_PATHS = "$(inherited)";
PRODUCT_NAME = "$(TARGET_NAME)";
- TARGETED_DEVICE_FAMILY = "1,2";
+ SDKROOT = iphoneos;
USER_HEADER_SEARCH_PATHS = ../../include;
- WRAPPER_EXTENSION = app;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
+ 963AD8CE17D5FFD9000B0779 /* Build configuration list for PBXLegacyTarget "Generate" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 963AD8CC17D5FFD9000B0779 /* Debug */,
+ 963AD8CD17D5FFD9000B0779 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
968E1E381779A54F0050CEA3 /* Build configuration list for PBXProject "MuPDF" */ = {
isa = XCConfigurationList;
buildConfigurations = (
diff --git a/platform/ios/build_libs.sh b/platform/ios/build_libs.sh
index 915145d9..d78a36cf 100644
--- a/platform/ios/build_libs.sh
+++ b/platform/ios/build_libs.sh
@@ -4,32 +4,28 @@
# cross compile MuPDF and third party libraries using the regular Makefile.
# Also see "iOS" section in Makerules.
-echo Generating cmap and font files
-echo "Apple broke Xcode external targets yet again, and I can't be bothered to fix it."
-echo "Run the 'make generate' command manually from now on!"
-echo "If you see an error while running GEN, you've forgotten."
-
-# make -C .. verbose=yes generate || exit 1
+if [ ! -e ../../generated/gen_cmap_korea.h ]
+then
+ echo 'ERROR: You are missing the generated files.'
+ echo 'ERROR: Please run "make generate" from the mupdf directory.'
+ exit 1
+fi
export OS=ios
export build=$(echo $CONFIGURATION | tr A-Z a-z)
-case $ARCHS in
- armv6) ARCHFLAGS="-arch armv6 -mno-thumb" ;;
- armv7) ARCHFLAGS="-arch armv7 -mthumb" ;;
- i386) ARCHFLAGS="-arch i386" ;;
- *) echo "Unknown architecture:" $ARCHS; exit 1 ;;
-esac
-
-export CFLAGS="$ARCHFLAGS -isysroot $SDKROOT"
-export LDFLAGS="$ARCHFLAGS -isysroot $SDKROOT"
+FLAGS=""
+for A in $ARCHS
+do
+ FLAGS="$FLAGS -arch $A"
+done
-OUT=build/$build-$OS-$ARCHS
+OUT=build/$build-$OS-$(echo $ARCHS | tr ' ' '-')
-echo Building libraries for $ARCHS.
-make -C ../.. OUT=$OUT third libs || exit 1
+echo Compiling libraries for $ARCHS.
+make -j4 -C ../.. OUT=$OUT XCFLAGS="$FLAGS" XLDFLAGS="$FLAGS" third libs || exit 1
-echo Assembling final library in $TARGET_BUILD_DIR/.
+echo Copying library to $TARGET_BUILD_DIR/.
mkdir -p "$TARGET_BUILD_DIR"
cp -f ../../$OUT/lib*.a $TARGET_BUILD_DIR
ranlib $TARGET_BUILD_DIR/lib*.a