From 29fa1dd52289ea3141c251f66b70bf660c7724e1 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Fri, 20 Mar 2015 15:45:32 +0200 Subject: Add support for checking out git repos to subprojects automatically. --- manual tests/1 wrap/subprojects/sqlite.wrap | 2 +- manual tests/2 multiwrap/subprojects/libpng.wrap | 3 +- manual tests/2 multiwrap/subprojects/lua.wrap | 2 +- manual tests/2 multiwrap/subprojects/zlib.wrap | 2 +- manual tests/3 git wrap/meson.build | 8 +++++ manual tests/3 git wrap/prog.c | 6 ++++ .../3 git wrap/subprojects/samplesubproject.wrap | 4 +++ manual tests/3 standalone binaries/Info.plist | 26 -------------- .../3 standalone binaries/build_linux_package.sh | 12 ------- .../3 standalone binaries/build_osx_package.sh | 21 ----------- .../3 standalone binaries/linux_bundler.sh | 7 ---- manual tests/3 standalone binaries/meson.build | 30 ---------------- manual tests/3 standalone binaries/myapp.cpp | 39 --------------------- manual tests/3 standalone binaries/myapp.icns | Bin 1831 -> 0 bytes manual tests/3 standalone binaries/myapp.sh | 10 ------ manual tests/3 standalone binaries/osx_bundler.sh | 6 ---- manual tests/3 standalone binaries/readme.txt | 12 ------- manual tests/3 standalone binaries/template.dmg.gz | Bin 37311 -> 0 bytes manual tests/4 standalone binaries/Info.plist | 26 ++++++++++++++ .../4 standalone binaries/build_linux_package.sh | 12 +++++++ .../4 standalone binaries/build_osx_package.sh | 21 +++++++++++ .../4 standalone binaries/linux_bundler.sh | 7 ++++ manual tests/4 standalone binaries/meson.build | 30 ++++++++++++++++ manual tests/4 standalone binaries/myapp.cpp | 39 +++++++++++++++++++++ manual tests/4 standalone binaries/myapp.icns | Bin 0 -> 1831 bytes manual tests/4 standalone binaries/myapp.sh | 10 ++++++ manual tests/4 standalone binaries/osx_bundler.sh | 6 ++++ manual tests/4 standalone binaries/readme.txt | 12 +++++++ manual tests/4 standalone binaries/template.dmg.gz | Bin 0 -> 37311 bytes 29 files changed, 185 insertions(+), 168 deletions(-) create mode 100644 manual tests/3 git wrap/meson.build create mode 100644 manual tests/3 git wrap/prog.c create mode 100644 manual tests/3 git wrap/subprojects/samplesubproject.wrap delete mode 100644 manual tests/3 standalone binaries/Info.plist delete mode 100755 manual tests/3 standalone binaries/build_linux_package.sh delete mode 100755 manual tests/3 standalone binaries/build_osx_package.sh delete mode 100755 manual tests/3 standalone binaries/linux_bundler.sh delete mode 100644 manual tests/3 standalone binaries/meson.build delete mode 100644 manual tests/3 standalone binaries/myapp.cpp delete mode 100644 manual tests/3 standalone binaries/myapp.icns delete mode 100755 manual tests/3 standalone binaries/myapp.sh delete mode 100755 manual tests/3 standalone binaries/osx_bundler.sh delete mode 100644 manual tests/3 standalone binaries/readme.txt delete mode 100644 manual tests/3 standalone binaries/template.dmg.gz create mode 100644 manual tests/4 standalone binaries/Info.plist create mode 100755 manual tests/4 standalone binaries/build_linux_package.sh create mode 100755 manual tests/4 standalone binaries/build_osx_package.sh create mode 100755 manual tests/4 standalone binaries/linux_bundler.sh create mode 100644 manual tests/4 standalone binaries/meson.build create mode 100644 manual tests/4 standalone binaries/myapp.cpp create mode 100644 manual tests/4 standalone binaries/myapp.icns create mode 100755 manual tests/4 standalone binaries/myapp.sh create mode 100755 manual tests/4 standalone binaries/osx_bundler.sh create mode 100644 manual tests/4 standalone binaries/readme.txt create mode 100644 manual tests/4 standalone binaries/template.dmg.gz (limited to 'manual tests') diff --git a/manual tests/1 wrap/subprojects/sqlite.wrap b/manual tests/1 wrap/subprojects/sqlite.wrap index 879a170d6..b56e7e27d 100644 --- a/manual tests/1 wrap/subprojects/sqlite.wrap +++ b/manual tests/1 wrap/subprojects/sqlite.wrap @@ -1,4 +1,4 @@ -[mesonwrap] +[wrap-file] directory = sqlite-amalgamation-3080802 source_url = http://sqlite.com/2015/sqlite-amalgamation-3080802.zip diff --git a/manual tests/2 multiwrap/subprojects/libpng.wrap b/manual tests/2 multiwrap/subprojects/libpng.wrap index bd6508040..d7cb93e01 100644 --- a/manual tests/2 multiwrap/subprojects/libpng.wrap +++ b/manual tests/2 multiwrap/subprojects/libpng.wrap @@ -1,5 +1,4 @@ -[mesonwrap] - +[wrap-file] directory = libpng-1.6.16 source_url = ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/libpng-1.6.16.tar.gz diff --git a/manual tests/2 multiwrap/subprojects/lua.wrap b/manual tests/2 multiwrap/subprojects/lua.wrap index da2ca1468..8f19d151f 100644 --- a/manual tests/2 multiwrap/subprojects/lua.wrap +++ b/manual tests/2 multiwrap/subprojects/lua.wrap @@ -1,4 +1,4 @@ -[mesonwrap] +[wrap-file] directory = lua-5.3.0 source_url = http://www.lua.org/ftp/lua-5.3.0.tar.gz diff --git a/manual tests/2 multiwrap/subprojects/zlib.wrap b/manual tests/2 multiwrap/subprojects/zlib.wrap index 7ea335428..37202f8d4 100644 --- a/manual tests/2 multiwrap/subprojects/zlib.wrap +++ b/manual tests/2 multiwrap/subprojects/zlib.wrap @@ -1,4 +1,4 @@ -[mesonwrap] +[wrap-file] directory = zlib-1.2.8 source_url = http://zlib.net/zlib-1.2.8.tar.gz diff --git a/manual tests/3 git wrap/meson.build b/manual tests/3 git wrap/meson.build new file mode 100644 index 000000000..f3cce0014 --- /dev/null +++ b/manual tests/3 git wrap/meson.build @@ -0,0 +1,8 @@ +project('git outcheckker', 'c') + +sp = subproject('samplesubproject') + +exe = executable('gitprog', 'prog.c', +include_directories : sp.get_variable('subproj_inc'), +link_with : sp.get_variable('subproj_lib'), +) diff --git a/manual tests/3 git wrap/prog.c b/manual tests/3 git wrap/prog.c new file mode 100644 index 000000000..df38000ec --- /dev/null +++ b/manual tests/3 git wrap/prog.c @@ -0,0 +1,6 @@ +#include"subproj.h" + +int main(int argc, char **argv) { + subproj_function(); + return 0; +} diff --git a/manual tests/3 git wrap/subprojects/samplesubproject.wrap b/manual tests/3 git wrap/subprojects/samplesubproject.wrap new file mode 100644 index 000000000..f52190b8f --- /dev/null +++ b/manual tests/3 git wrap/subprojects/samplesubproject.wrap @@ -0,0 +1,4 @@ +[wrap-git] +directory=samplesubproject +url=https://github.com/jpakkane/samplesubproject.git +revision=head diff --git a/manual tests/3 standalone binaries/Info.plist b/manual tests/3 standalone binaries/Info.plist deleted file mode 100644 index 0f0c90e49..000000000 --- a/manual tests/3 standalone binaries/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleGetInfoString - MyApp - CFBundleExecutable - myapp.sh - CFBundleIdentifier - com.example.me - CFBundleName - myapp - CFBundleIconFile - myapp.icns - CFBundleShortVersionString - 1.0 - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - IFMajorVersion - 0 - IFMinorVersion - 1 - - diff --git a/manual tests/3 standalone binaries/build_linux_package.sh b/manual tests/3 standalone binaries/build_linux_package.sh deleted file mode 100755 index 806a453cb..000000000 --- a/manual tests/3 standalone binaries/build_linux_package.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -curdir=`pwd` -rm -rf buildtmp -mkdir buildtmp -LDFLAGS=-static-libstdc++ ~/meson/meson.py buildtmp --buildtype=release --prefix=/tmp/myapp --libdir=lib --strip -ninja -C buildtmp install -rm -rf buildtmp -cd /tmp/ -tar czf myapp.tar.gz myapp -mv myapp.tar.gz "$curdir" -rm -rf myapp diff --git a/manual tests/3 standalone binaries/build_osx_package.sh b/manual tests/3 standalone binaries/build_osx_package.sh deleted file mode 100755 index eca11c635..000000000 --- a/manual tests/3 standalone binaries/build_osx_package.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -rm -rf buildtmp -mkdir buildtmp -~/meson/meson.py buildtmp --buildtype=release --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 standalone binaries/linux_bundler.sh b/manual tests/3 standalone binaries/linux_bundler.sh deleted file mode 100755 index a0e5c122f..000000000 --- a/manual tests/3 standalone binaries/linux_bundler.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -libdir="${MESON_INSTALL_PREFIX}/lib" -mkdir -p $libdir -sdlfile=`ldd ${MESON_INSTALL_PREFIX}/bin/myapp | grep libSDL | cut -d ' ' -f 3` -cp $sdlfile "${libdir}" -strip "${libdir}/libSDL"* diff --git a/manual tests/3 standalone binaries/meson.build b/manual tests/3 standalone binaries/meson.build deleted file mode 100644 index e5e6ee06f..000000000 --- a/manual tests/3 standalone binaries/meson.build +++ /dev/null @@ -1,30 +0,0 @@ -project('myapp', 'cpp') - -sdl = dependency('sdl2') - -if meson.get_compiler('cpp').get_id() != 'msvc' - add_global_arguments('-std=c++11', language : 'cpp') -endif - -if host.name() == 'darwin' - 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('osx_bundler.sh') -endif - -if host.name() == 'linux' - install_data('myapp.sh', install_dir : '.') - meson.set_install_script('linux_bundler.sh') -endif - - -prog = executable('myapp', 'myapp.cpp', -dependencies : sdl, -install : true) diff --git a/manual tests/3 standalone binaries/myapp.cpp b/manual tests/3 standalone binaries/myapp.cpp deleted file mode 100644 index c57fd04af..000000000 --- a/manual tests/3 standalone binaries/myapp.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include -#include -#include - -int main(int argc, char **argv) { - SDL_Surface *screenSurface; - SDL_Event e; - int keepGoing = 1; - std::string message; - - if(SDL_Init( SDL_INIT_VIDEO ) < 0) { - printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() ); - } - atexit(SDL_Quit); - - std::unique_ptr window(SDL_CreateWindow( "My application", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN), SDL_DestroyWindow); - screenSurface = SDL_GetWindowSurface(window.get()); - - // Use iostream to make sure we have not screwed - // up libstdc++ linking. - message = "Window created."; - message += " Starting main loop."; - std::cout << message << std::endl; - - 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.get()); - SDL_Delay(100); - } - - return 0; -} diff --git a/manual tests/3 standalone binaries/myapp.icns b/manual tests/3 standalone binaries/myapp.icns deleted file mode 100644 index 633195454..000000000 Binary files a/manual tests/3 standalone binaries/myapp.icns and /dev/null differ diff --git a/manual tests/3 standalone binaries/myapp.sh b/manual tests/3 standalone binaries/myapp.sh deleted file mode 100755 index 319148353..000000000 --- a/manual tests/3 standalone binaries/myapp.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -cd "${0%/*}" - -if [ `uname` == 'Darwin' ]; then - ./myapp -else - export LD_LIBRARY_PATH="`pwd`/lib" - bin/myapp -fi diff --git a/manual tests/3 standalone binaries/osx_bundler.sh b/manual tests/3 standalone binaries/osx_bundler.sh deleted file mode 100755 index f61187fc3..000000000 --- a/manual tests/3 standalone binaries/osx_bundler.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 standalone binaries/readme.txt b/manual tests/3 standalone binaries/readme.txt deleted file mode 100644 index 6b26c49ee..000000000 --- a/manual tests/3 standalone binaries/readme.txt +++ /dev/null @@ -1,12 +0,0 @@ -This directory shows how you can build redistributable binaries. On -OSX this menans building an app bundle and a .dmg installer. On Linux -it means building a binary that bundles its dependencies. On Windows -it means probably building an .exe installer or something (not done -yet). - -To build each package you run the corresponding build_ARCH.sh build script. - -On Linux you must build the package on the oldest distribution you -plan to support (Debian stable/oldstable and old CentOS are usually -the choice here). - diff --git a/manual tests/3 standalone binaries/template.dmg.gz b/manual tests/3 standalone binaries/template.dmg.gz deleted file mode 100644 index fcb6d6115..000000000 Binary files a/manual tests/3 standalone binaries/template.dmg.gz and /dev/null differ diff --git a/manual tests/4 standalone binaries/Info.plist b/manual tests/4 standalone binaries/Info.plist new file mode 100644 index 000000000..0f0c90e49 --- /dev/null +++ b/manual tests/4 standalone binaries/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleGetInfoString + MyApp + CFBundleExecutable + myapp.sh + CFBundleIdentifier + com.example.me + CFBundleName + myapp + CFBundleIconFile + myapp.icns + CFBundleShortVersionString + 1.0 + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + IFMajorVersion + 0 + IFMinorVersion + 1 + + diff --git a/manual tests/4 standalone binaries/build_linux_package.sh b/manual tests/4 standalone binaries/build_linux_package.sh new file mode 100755 index 000000000..806a453cb --- /dev/null +++ b/manual tests/4 standalone binaries/build_linux_package.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +curdir=`pwd` +rm -rf buildtmp +mkdir buildtmp +LDFLAGS=-static-libstdc++ ~/meson/meson.py buildtmp --buildtype=release --prefix=/tmp/myapp --libdir=lib --strip +ninja -C buildtmp install +rm -rf buildtmp +cd /tmp/ +tar czf myapp.tar.gz myapp +mv myapp.tar.gz "$curdir" +rm -rf myapp diff --git a/manual tests/4 standalone binaries/build_osx_package.sh b/manual tests/4 standalone binaries/build_osx_package.sh new file mode 100755 index 000000000..eca11c635 --- /dev/null +++ b/manual tests/4 standalone binaries/build_osx_package.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +rm -rf buildtmp +mkdir buildtmp +~/meson/meson.py buildtmp --buildtype=release --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/4 standalone binaries/linux_bundler.sh b/manual tests/4 standalone binaries/linux_bundler.sh new file mode 100755 index 000000000..a0e5c122f --- /dev/null +++ b/manual tests/4 standalone binaries/linux_bundler.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +libdir="${MESON_INSTALL_PREFIX}/lib" +mkdir -p $libdir +sdlfile=`ldd ${MESON_INSTALL_PREFIX}/bin/myapp | grep libSDL | cut -d ' ' -f 3` +cp $sdlfile "${libdir}" +strip "${libdir}/libSDL"* diff --git a/manual tests/4 standalone binaries/meson.build b/manual tests/4 standalone binaries/meson.build new file mode 100644 index 000000000..e5e6ee06f --- /dev/null +++ b/manual tests/4 standalone binaries/meson.build @@ -0,0 +1,30 @@ +project('myapp', 'cpp') + +sdl = dependency('sdl2') + +if meson.get_compiler('cpp').get_id() != 'msvc' + add_global_arguments('-std=c++11', language : 'cpp') +endif + +if host.name() == 'darwin' + 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('osx_bundler.sh') +endif + +if host.name() == 'linux' + install_data('myapp.sh', install_dir : '.') + meson.set_install_script('linux_bundler.sh') +endif + + +prog = executable('myapp', 'myapp.cpp', +dependencies : sdl, +install : true) diff --git a/manual tests/4 standalone binaries/myapp.cpp b/manual tests/4 standalone binaries/myapp.cpp new file mode 100644 index 000000000..c57fd04af --- /dev/null +++ b/manual tests/4 standalone binaries/myapp.cpp @@ -0,0 +1,39 @@ +#include +#include +#include +#include + +int main(int argc, char **argv) { + SDL_Surface *screenSurface; + SDL_Event e; + int keepGoing = 1; + std::string message; + + if(SDL_Init( SDL_INIT_VIDEO ) < 0) { + printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() ); + } + atexit(SDL_Quit); + + std::unique_ptr window(SDL_CreateWindow( "My application", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN), SDL_DestroyWindow); + screenSurface = SDL_GetWindowSurface(window.get()); + + // Use iostream to make sure we have not screwed + // up libstdc++ linking. + message = "Window created."; + message += " Starting main loop."; + std::cout << message << std::endl; + + 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.get()); + SDL_Delay(100); + } + + return 0; +} diff --git a/manual tests/4 standalone binaries/myapp.icns b/manual tests/4 standalone binaries/myapp.icns new file mode 100644 index 000000000..633195454 Binary files /dev/null and b/manual tests/4 standalone binaries/myapp.icns differ diff --git a/manual tests/4 standalone binaries/myapp.sh b/manual tests/4 standalone binaries/myapp.sh new file mode 100755 index 000000000..319148353 --- /dev/null +++ b/manual tests/4 standalone binaries/myapp.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +cd "${0%/*}" + +if [ `uname` == 'Darwin' ]; then + ./myapp +else + export LD_LIBRARY_PATH="`pwd`/lib" + bin/myapp +fi diff --git a/manual tests/4 standalone binaries/osx_bundler.sh b/manual tests/4 standalone binaries/osx_bundler.sh new file mode 100755 index 000000000..f61187fc3 --- /dev/null +++ b/manual tests/4 standalone binaries/osx_bundler.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/4 standalone binaries/readme.txt b/manual tests/4 standalone binaries/readme.txt new file mode 100644 index 000000000..6b26c49ee --- /dev/null +++ b/manual tests/4 standalone binaries/readme.txt @@ -0,0 +1,12 @@ +This directory shows how you can build redistributable binaries. On +OSX this menans building an app bundle and a .dmg installer. On Linux +it means building a binary that bundles its dependencies. On Windows +it means probably building an .exe installer or something (not done +yet). + +To build each package you run the corresponding build_ARCH.sh build script. + +On Linux you must build the package on the oldest distribution you +plan to support (Debian stable/oldstable and old CentOS are usually +the choice here). + diff --git a/manual tests/4 standalone binaries/template.dmg.gz b/manual tests/4 standalone binaries/template.dmg.gz new file mode 100644 index 000000000..fcb6d6115 Binary files /dev/null and b/manual tests/4 standalone binaries/template.dmg.gz differ -- cgit v1.2.3