Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,16 @@ INCLUDES += $(INCLUDE). \
HEADERS += $(wildcard src/*.h) $(shell find vendor -name '*.h')
SRCS += $(wildcard src/*.c) $(wildcard src/image/*.c) $(wildcard vendor/bzip2/*.c) vendor/md5/md5.c vendor/sha1/sha1.c vendor/base64/base64.c

ifeq ($(OS),iOS)
PLATFORM := ios
BACKEND := ios
AUDIO_BACKEND := openal
DISABLE_LEGACY_GL := 1
else
PLATFORM := cli
BACKEND := glfw3
AUDIO_BACKEND := miniaudio
endif

ifdef BUTTERSCOTCH_COMMIT_DATE
DEFINES += $(DEFINE)BUTTERSCOTCH_COMMIT_DATE=\"$(BUTTERSCOTCH_COMMIT_DATE)\"
Expand Down Expand Up @@ -127,6 +134,11 @@ LIBS += -framework Cocoa -framework GameController
DEFINES += $(DEFINE)USE_APPKIT
SYSCFLAGS += -Wno-deprecated-declarations
endif
ifeq ($(BACKEND),ios)
LIBS += -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -framework CoreGraphics
DEFINES += $(DEFINE)USE_IOS
ENABLE_GLAD := 1
endif

# GNU make doesn't have a way to do OR in conditionals, stupid language for clowns
ifndef DISABLE_LEGACY_GL
Expand Down Expand Up @@ -176,15 +188,19 @@ DEFINES += $(DEFINE)USE_MINIAUDIO
SRCS += $(wildcard src/audio/miniaudio/*.c)
HEADERS += $(wildcard src/audio/miniaudio/*.h)
ifneq ($(OS),Windows)
ifeq ($(OS),iOS)
LIBS += -framework AVFoundation -framework AudioToolbox
else
LIBS += -pthread
endif
endif
endif
ifeq ($(AUDIO_BACKEND),openal)
INCLUDES += $(INCLUDE)src/audio/openal
DEFINES += $(DEFINE)USE_OPENAL
SRCS += $(wildcard src/audio/openal/*.c)
HEADERS += $(wildcard src/audio/openal/*.h)
ifeq ($(OS),Darwin)
ifneq ($(filter Darwin iOS,$(OS)),) # OS is 'Darwin' or 'iOS'
LIBS += -framework OpenAL
else
LIBS += -lopenal
Expand All @@ -193,7 +209,7 @@ endif

ifdef ENABLE_GLAD
SRCS += vendor/glad/src/glad.c
INCLUDES += $(INCLUDE)vendor/glad/include
INCLUDES += $(INCLUDE)vendor/glad/include $(INCLUDE)src/gl_common
endif

ifeq ($(OS),Windows)
Expand All @@ -206,7 +222,7 @@ LIBS += -lwinmm
endif
DEFINES += $(DEFINE)WIN32_LEAN_AND_MEAN
else
ifeq ($(OS),Darwin)
ifneq ($(filter Darwin iOS,$(OS)),) # OS is 'Darwin' or 'iOS'
LIBS += -lobjc
else
LIBS += -lm
Expand All @@ -231,10 +247,11 @@ compat/config.mk: compat/configure.sh compat/tmp/cc

endif

build/butterscotch: $(OBJS)
build/butterscotch: $(OBJS) $(if $(filter iOS,$(OS)),artifacts/ios/build-ipa.sh $(wildcard artifacts/ios/assets/*))
@{ [ -z "$(NO_COLOR)" ] && [ -t 1 ]; } && printf " \033[1;34mLD\033[0m butterscotch\n" || printf " LD butterscotch\n"
$(V)MSYS2_ARG_CONV_EXCL='*' $(_CC) $(LDFLAGS) $(OBJS) $(LIBS) $(EXTRALIBS) $(OUTPUT_EXE)$@
@[ -f $@.exe ] && chmod +x $@.exe || true
@if [ "$(OS)" = 'iOS' ]; then artifacts/ios/build-ipa.sh; fi

build/%.$(OBJ_EXT): % compat/config.mk $(if $(DISABLE_MMD),$(HEADERS))
@mkdir -p $(dir $@)
Expand Down
28 changes: 28 additions & 0 deletions artifacts/ios/SDKSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"DisplayName": "iOS 8.0",
"DocSetFeedURL": "http://developer.apple.com/rss/com.apple.adc.documentation.AppleiPhone8_0.atom",
"MinimalDisplayName": "8.0",
"DefaultProperties": {
"AD_HOC_CODE_SIGNING_ALLOWED": "NO",
"SUPPORTED_DEVICE_FAMILIES": "1,2",
"DEFAULT_COMPILER": "com.apple.compilers.llvm.clang.1_0",
"IPHONEOS_DEPLOYMENT_TARGET": "8.0",
"DEAD_CODE_STRIPPING": "YES",
"CODE_SIGN_ENTITLEMENTS": "",
"ENTITLEMENTS_REQUIRED": "YES",
"CODE_SIGNING_REQUIRED": "YES",
"PLATFORM_NAME": "iphoneos",
"GCC_THUMB_SUPPORT": "YES"
},
"Version": "8.0",
"Toolchains": [
"com.apple.dt.toolchain.iOS8_0"
],
"MinimumSupportedToolsVersion": "3.2.3",
"IsBaseSDK": "YES",
"AlternateSDK": "iphonesimulator8.0",
"MaximumDeploymentTarget": "8.0.99",
"CanonicalName": "iphoneos8.0",
"DocSetFeedName": "Apple iPhone OS 8.0",
"CustomProperties": {}
}
Binary file added artifacts/ios/assets/Default-568h@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Default-667h@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Default-736h@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Default-812h@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Default@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Icon-20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Icon-20@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Icon-20@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Icon-40.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Icon-40@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Icon-40@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions artifacts/ios/assets/Icon-60@2x.png
Binary file added artifacts/ios/assets/Icon-60@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Icon-72.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Icon-72@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Icon-76.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Icon-76@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Icon-83.5@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Icon-Small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Icon-Small@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Icon-Small@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artifacts/ios/assets/Icon@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
146 changes: 146 additions & 0 deletions artifacts/ios/assets/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?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">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Butterscotch</string>
<key>CFBundleExecutable</key>
<string>butterscotch</string>
<key>CFBundleIdentifier</key>
<string>com.mrpowergamerbr.butterscotch</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Butterscotch</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>MinimumOSVersion</key>
<string>2.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIStatusBarHidden</key>
<true/>
<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CFBundleIconFiles</key>
<array>
<string>Icon.png</string>
<string>Icon@2x.png</string>
<string>Icon-72.png</string>
<string>Icon-72@2x.png</string>
<string>Icon-Small.png</string>
<string>Icon-Small@2x.png</string>
</array>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Icon-20.png</string>
<string>Icon-20@2x.png</string>
<string>Icon-20@3x.png</string>
<string>Icon-40.png</string>
<string>Icon-40@2x.png</string>
<string>Icon-40@3x.png</string>
<string>Icon-60@2x.png</string>
<string>Icon-60@3x.png</string>
</array>
</dict>
</dict>
<key>CFBundleIcons~ipad</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Icon-20.png</string>
<string>Icon-20@2x.png</string>
<string>Icon-40.png</string>
<string>Icon-40@2x.png</string>
<string>Icon-72.png</string>
<string>Icon-72@2x.png</string>
<string>Icon-76.png</string>
<string>Icon-76@2x.png</string>
<string>Icon-83.5@2x.png</string>
</array>
</dict>
</dict>
<key>UILaunchImages</key>
<array>
<dict>
<key>UILaunchImageName</key>
<string>Default</string>
<key>UILaunchImageMinimumOSVersion</key>
<string>2.0</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{320, 480}</string>
</dict>
<dict>
<key>UILaunchImageName</key>
<string>Default-568h</string>
<key>UILaunchImageMinimumOSVersion</key>
<string>7.0</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{320, 568}</string>
</dict>
<dict>
<key>UILaunchImageName</key>
<string>Default-667h</string>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{375, 667}</string>
</dict>
<dict>
<key>UILaunchImageName</key>
<string>Default-736h</string>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{414, 736}</string>
</dict>
<dict>
<key>UILaunchImageName</key>
<string>Default-812h</string>
<key>UILaunchImageMinimumOSVersion</key>
<string>11.0</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{375, 812}</string>
</dict>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
</dict>
</plist>
Binary file added artifacts/ios/assets/iTunesArtwork
Binary file not shown.
Binary file added artifacts/ios/assets/iTunesArtwork@2x
Binary file not shown.
26 changes: 26 additions & 0 deletions artifacts/ios/build-ipa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh
set -e

apppath="build/Payload/butterscotch.app"

if ! [ -f build/butterscotch ]; then
printf 'Expected a binary at build/butterscotch\n'
exit 1
fi

printf 'Creating butterscotch.ipa\n'

rm -rf "$apppath"
mkdir -p "$apppath"
if command -v ldid >/dev/null; then
ldid -Sartifacts/ios/butterscotch.entitlements build/butterscotch
else
codesign -f -s - --entitlements artifacts/ios/butterscotch.entitlements build/butterscotch
fi
cp build/butterscotch "$apppath/butterscotch"
cp -a artifacts/ios/assets/* "$apppath"
command -v plistutil >/dev/null && plistutil -i artifacts/ios/assets/Info.plist -o "$apppath/Info.plist" -f bin

cd build
rm -f butterscotch.ipa
zip -qr butterscotch.ipa Payload
Loading
Loading