aboutsummaryrefslogtreecommitdiff
path: root/manual tests
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-03-10 16:45:39 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2015-03-10 17:12:54 +0200
commitb4b2e8d5331878f9b2dcf807c0d277b6dc880959 (patch)
treeb78de431451213711d07b93402173373b512623a /manual tests
parentf9f51b1ac7f86ed4be78ea830a414ec0c27fb044 (diff)
downloadmeson-b4b2e8d5331878f9b2dcf807c0d277b6dc880959.zip
meson-b4b2e8d5331878f9b2dcf807c0d277b6dc880959.tar.gz
meson-b4b2e8d5331878f9b2dcf807c0d277b6dc880959.tar.bz2
Added an example of how to create OSX installers.
Diffstat (limited to 'manual tests')
-rw-r--r--manual tests/3 osx bundle/Info.plist26
-rwxr-xr-xmanual tests/3 osx bundle/build_osx_installer.sh21
-rwxr-xr-xmanual tests/3 osx bundle/install_script.sh6
-rw-r--r--manual tests/3 osx bundle/meson.build18
-rw-r--r--manual tests/3 osx bundle/myapp.c31
-rw-r--r--manual tests/3 osx bundle/myapp.icnsbin0 -> 1831 bytes
-rwxr-xr-xmanual tests/3 osx bundle/myapp.sh4
-rw-r--r--manual tests/3 osx bundle/template.dmg.gzbin0 -> 37311 bytes
8 files changed, 106 insertions, 0 deletions
diff --git a/manual tests/3 osx bundle/Info.plist b/manual tests/3 osx bundle/Info.plist
new file mode 100644
index 0000000..0f0c90e
--- /dev/null
+++ b/manual tests/3 osx bundle/Info.plist
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleGetInfoString</key>
+ <string>MyApp</string>
+ <key>CFBundleExecutable</key>
+ <string>myapp.sh</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.example.me</string>
+ <key>CFBundleName</key>
+ <string>myapp</string>
+ <key>CFBundleIconFile</key>
+ <string>myapp.icns</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>IFMajorVersion</key>
+ <integer>0</integer>
+ <key>IFMinorVersion</key>
+ <integer>1</integer>
+</dict>
+</plist>
diff --git a/manual tests/3 osx bundle/build_osx_installer.sh b/manual tests/3 osx bundle/build_osx_installer.sh
new file mode 100755
index 0000000..9225415
--- /dev/null
+++ b/manual tests/3 osx bundle/build_osx_installer.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+rm -rf buildtmp
+mkdir buildtmp
+~/meson/meson.py buildtmp --prefix=/tmp/myapp.app --bindir=Contents/MacOS
+ninja -C buildtmp install
+rm -rf buildtmp
+mkdir -p mnttmp
+rm -f working.dmg
+gunzip < template.dmg.gz > working.dmg
+hdiutil attach working.dmg -noautoopen -quiet -mountpoint mnttmp
+# NOTE: output of hdiutil changes every now and then.
+# Verify that this is still working.
+DEV=`hdiutil info|tail -1|awk '{print $1}'`
+rm -rf mnttmp/myapp.app
+mv /tmp/myapp.app mnttmp
+hdiutil detach ${DEV}
+rm -rf mnttmp
+rm -f myapp.dmg
+hdiutil convert working.dmg -quiet -format UDZO -imagekey zlib-level=9 -o myapp.dmg
+rm -f working.dmg
diff --git a/manual tests/3 osx bundle/install_script.sh b/manual tests/3 osx bundle/install_script.sh
new file mode 100755
index 0000000..f61187f
--- /dev/null
+++ b/manual tests/3 osx bundle/install_script.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+mkdir -p ${MESON_INSTALL_PREFIX}/Contents/Frameworks
+cp -r /Library/Frameworks/SDL2.framework ${MESON_INSTALL_PREFIX}/Contents/Frameworks
+
+install_name_tool -change @rpath/SDL2.framework/Versions/A/SDL2 @executable_path/../Frameworks/SDL2.framework/Versions/A/SDL2 ${MESON_INSTALL_PREFIX}/Contents/MacOS/myapp
diff --git a/manual tests/3 osx bundle/meson.build b/manual tests/3 osx bundle/meson.build
new file mode 100644
index 0000000..13ab29a
--- /dev/null
+++ b/manual tests/3 osx bundle/meson.build
@@ -0,0 +1,18 @@
+project('myapp', 'c')
+
+sdl = dependency('sdl2')
+
+prog = executable('myapp', 'myapp.c',
+dependencies : sdl,
+install : true)
+
+install_data('myapp.sh',
+install_dir : 'Contents/MacOS')
+
+install_data('myapp.icns',
+install_dir : 'Contents/Resources')
+
+install_data('Info.plist',
+install_dir : 'Contents')
+
+meson.set_install_script('install_script.sh')
diff --git a/manual tests/3 osx bundle/myapp.c b/manual tests/3 osx bundle/myapp.c
new file mode 100644
index 0000000..83a4e4c
--- /dev/null
+++ b/manual tests/3 osx bundle/myapp.c
@@ -0,0 +1,31 @@
+#include<SDL.h>
+
+int main(int argc, char **argv) {
+ SDL_Window *window;
+ SDL_Surface *screenSurface;
+ SDL_Event e;
+ int keepGoing = 1;
+ if(SDL_Init( SDL_INIT_VIDEO ) < 0) {
+ printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() );
+ }
+
+ window = SDL_CreateWindow( "My application", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN );
+
+ screenSurface = SDL_GetWindowSurface( window );
+
+ while(keepGoing) {
+ while(SDL_PollEvent(&e) != 0) {
+ if(e.type == SDL_QUIT) {
+ keepGoing = 0;
+ break;
+ }
+ }
+ SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 0xFF, 0x00, 0x00 ) );
+ SDL_UpdateWindowSurface( window );
+ SDL_Delay(100);
+ }
+
+ SDL_DestroyWindow(window);
+ SDL_Quit();
+ return 0;
+}
diff --git a/manual tests/3 osx bundle/myapp.icns b/manual tests/3 osx bundle/myapp.icns
new file mode 100644
index 0000000..6331954
--- /dev/null
+++ b/manual tests/3 osx bundle/myapp.icns
Binary files differ
diff --git a/manual tests/3 osx bundle/myapp.sh b/manual tests/3 osx bundle/myapp.sh
new file mode 100755
index 0000000..2303818
--- /dev/null
+++ b/manual tests/3 osx bundle/myapp.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+cd "${0%/*}"
+./myapp
diff --git a/manual tests/3 osx bundle/template.dmg.gz b/manual tests/3 osx bundle/template.dmg.gz
new file mode 100644
index 0000000..fcb6d61
--- /dev/null
+++ b/manual tests/3 osx bundle/template.dmg.gz
Binary files differ