Skip to content

Commit

Permalink
add separate iossim build option, as submitting universal binary with…
Browse files Browse the repository at this point in the history
… x86 is rejected
  • Loading branch information
ianmaclarty committed Jan 15, 2018
1 parent 1bc076a commit 3eccc0a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion scripts/gen_ios_info_plist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if [ -z "$DTPlatformVersion" ]; then echo unable to determine DTPlatformVersion;

#echo -DAM_DTXcodeBuild=$DTXcodeBuild -DAM_DTXcode=$DTXcode -DAM_DTCompiler=$DTCompiler -DAM_DTPlatformBuild=$DTPlatformBuild -DAM_DTPlatformName=$DTPlatformName -DAM_DTPlatformVersion=$DTPlatformVersion -DAM_DTSDKBuild=$DTSDKBuild -DAM_DTSDKName=$DTSDKName

for f in `find builds/ios/$luavm -name "bin" -type d`; do
for f in `find builds/ios/$luavm builds/iossim/$luavm -name "bin" -type d`; do
cat << EOF > $f/Info.plist
<?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">
Expand Down
2 changes: 0 additions & 2 deletions scripts/gen_ios_universal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ set -e
luavm=$1
for f in `find builds/ios32/$luavm -name "*.a"`; do
f64=`echo $f | sed 's/ios32/ios64/'`
fsim=`echo $f | sed 's/ios32/iossim/'`
out=`echo $f | sed 's/ios32/ios/'`
mkdir -p `dirname $out`
TARGETED_DEVICE_FAMILY=1,2 lipo -create $f $f64 $fsim -output $out
done
for f in `find builds/ios32/$luavm -name "amulet"`; do
f64=`echo $f | sed 's/ios32/ios64/'`
fsim=`echo $f | sed 's/ios32/iossim/'`
out=`echo $f | sed 's/ios32/ios/'`
mkdir -p `dirname $out`
TARGETED_DEVICE_FAMILY=1,2 lipo -create $f $f64 $fsim -output $out
Expand Down
11 changes: 6 additions & 5 deletions src/am_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static char *get_bin_path(export_config *conf, const char *platform) {

static char *get_export_zip_name(export_config *conf, const char *platname) {
const char *ext = "zip";
if (strcmp(platname, "ios") == 0) ext = "ipa";
if (strcmp(platname, "ios") == 0 || strcmp(platname, "iossim") == 0) ext = "ipa";
return am_format("%s-%s-%s.%s", conf->shortname, conf->version, platname, ext);
}

Expand Down Expand Up @@ -244,10 +244,10 @@ static bool build_mac_export(export_config *conf) {
return ok;
}

static bool build_ios_export(export_config *conf) {
char *zipname = get_export_zip_name(conf, "ios");
static bool build_ios_export(export_config *conf, bool sim) {
char *zipname = get_export_zip_name(conf, sim ? "iossim" : "ios");
if (am_file_exists(zipname)) am_delete_file(zipname);
char *binpath = get_bin_path(conf, "ios");
char *binpath = get_bin_path(conf, sim ? "iossim" : "ios");
if (binpath == NULL) return true;
if (!create_ios_info_plist(binpath, AM_TMP_DIR AM_PATH_SEP_STR "Info.plist", conf)) return false;
if (!create_ios_pkginfo(AM_TMP_DIR AM_PATH_SEP_STR "PkgInfo")) return false;
Expand Down Expand Up @@ -374,7 +374,8 @@ bool am_build_exports(uint32_t flags) {
bool ok =
((!(flags & AM_EXPORT_FLAG_WINDOWS)) || build_windows_export(&conf)) &&
((!(flags & AM_EXPORT_FLAG_OSX)) || build_mac_export(&conf)) &&
((!(flags & AM_EXPORT_FLAG_IOS)) || build_ios_export(&conf)) &&
((!(flags & AM_EXPORT_FLAG_IOS)) || build_ios_export(&conf, false)) &&
((!(flags & AM_EXPORT_FLAG_IOSSIM)) || build_ios_export(&conf, true)) &&
((!(flags & AM_EXPORT_FLAG_LINUX)) || build_linux_export(&conf)) &&
((!(flags & AM_EXPORT_FLAG_HTML)) || build_html_export(&conf)) &&
true;
Expand Down
3 changes: 2 additions & 1 deletion src/am_export.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#define AM_EXPORT_FLAG_LINUX 4
#define AM_EXPORT_FLAG_HTML 8
#define AM_EXPORT_FLAG_IOS 16
#define AM_EXPORT_FLAG_RECURSE 32
#define AM_EXPORT_FLAG_IOSSIM 32
#define AM_EXPORT_FLAG_RECURSE 64

bool am_build_exports(uint32_t flags);

Expand Down
8 changes: 5 additions & 3 deletions src/am_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ struct option {
static bool help_export() {
printf(
/*-------------------------------------------------------------------------------*/
"Usage: amulet export [-r] [-windows] [-mac] [-ios] [-linux] [-html] [ <dir> ]\n"
"Usage: amulet export [-r] [-windows] [-mac] [-ios] [-iossim] [-linux] [-html] [ <dir> ]\n"
"\n"
" Generates distribution packages for the project in <dir>,\n"
" or the current directory if <dir> is omitted.\n"
" <dir> should contain main.lua.\n"
"\n"
" If none of the -windows, -mac, -ios, -linux or -html options are given\n"
" If none of the -windows, -mac, -ios, -iossim -linux or -html options are given\n"
" then packages for all supported platforms will be generated,\n"
" otherwise only packages for the specified platforms will be generated.\n"
"\n"
Expand Down Expand Up @@ -172,6 +172,8 @@ static bool export_cmd(int *argc, char ***argv) {
flags |= AM_EXPORT_FLAG_LINUX;
} else if (strcmp(arg, "-ios") == 0) {
flags |= AM_EXPORT_FLAG_IOS;
} else if (strcmp(arg, "-iossim") == 0) {
flags |= AM_EXPORT_FLAG_IOSSIM;
} else if (strcmp(arg, "-html") == 0) {
flags |= AM_EXPORT_FLAG_HTML;
} else if (strcmp(arg, "-r") == 0) {
Expand All @@ -182,7 +184,7 @@ static bool export_cmd(int *argc, char ***argv) {
}
*argc -= i;
*argv += i;
if (flags == 0 || flags == AM_EXPORT_FLAG_RECURSE) flags = AM_EXPORT_FLAG_WINDOWS | AM_EXPORT_FLAG_OSX | AM_EXPORT_FLAG_LINUX | AM_EXPORT_FLAG_IOS | AM_EXPORT_FLAG_HTML;
if (flags == 0 || flags == AM_EXPORT_FLAG_RECURSE) flags |= AM_EXPORT_FLAG_WINDOWS | AM_EXPORT_FLAG_OSX | AM_EXPORT_FLAG_LINUX | AM_EXPORT_FLAG_IOS | AM_EXPORT_FLAG_HTML;
char *dir = (char*)".";
if (*argc > 0) {
dir = (*argv)[0];
Expand Down

0 comments on commit 3eccc0a

Please sign in to comment.