Skip to content

Instantly share code, notes, and snippets.

View wuhao5's full-sized avatar

Hao Wu wuhao5

  • Mountain View, CA
View GitHub Profile
@wuhao5
wuhao5 / png_build.sh
Last active December 1, 2019 21:53
build libpng for iOS/MacOS X
rm -rf install_*
rm -rf output-*
# build simulator
./configure --prefix=`pwd`/install_i386 CFLAGS="-Ofast -mios-version-min=5.0" LDFLAGS="-flto" CC="xcrun -sdk iphonesimulator clang -arch i386"
make clean && make -j8 && make install
./configure --prefix=`pwd`/install_x86_64 CFLAGS="-Ofast -mios-version-min=5.0" LDFLAGS="-flto" CC="xcrun -sdk iphonesimulator clang -arch x86_64"
make clean && make -j8 && make install
@wuhao5
wuhao5 / background.rb
Last active January 4, 2016 21:46
Appium UIA iOS 9.x workaround for backgrouding app
#!/usr/bin/env ruby
require "appium_lib"
APP_PATH="./node_modules/appium-uiauto/test/assets/UICatalog.app"
def desired_caps
{
caps: {
platformName: 'iOS',
1. Download Yosemite from the App Store (or your favorite digital content distribution warehouse)
2. Open terminal
3. Run "gem install iesd"
4. Run "iesd -i /Applications/Install\ OS\ X\ 10.10\ Developer\ Preview.app -o yosemite.dmg -t BaseSystem"
Adding additional steps because certain files end up missing from above:
5. Run "hdiutil convert yosemite.dmg -format UDSP -o yosemite.sparseimage"
6. Run "hdiutil mount /Applications/Install\ OS\ X\ 10.10\ Developer\ Preview.app/Contents/SharedSupport/InstallESD.dmg"
7. Run "hdiutil mount yosemite.sparseimage"
8. Run "cp /Volumes/OS\ X\ Install\ ESD/BaseSystem.* /Volumes/OS\ X\ Base\ System/"
# ==============================================================
# 10.9. Make an ISO from the Install.app
# ==============================================================
# Mount the installer image
hdiutil attach /Applications/Install\ OS\ X\ Mavericks.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
# Convert the boot image to a sparse bundle
hdiutil convert /Volumes/install_app/BaseSystem.dmg -format UDSP -o /tmp/Mavericks
# Increase the sparse bundle capacity to 8GB to accommodate the packages
@wuhao5
wuhao5 / wxlua-clang
Created August 6, 2014 07:24
wxLua cmake config for Clang and C++11
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=`pwd`/install -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_C_COMPILER=`xcrun -f clang` -DCMAKE_CXX_COMPILER=`xcrun -f clang++` -DwxWidgets_CONFIG_EXECUTABLE=../../../wxWidgets/install/bin/wx-config -DwxWidgets_COMPONENTS="stc;html;aui;adv;core;net;base" -DwxLuaBind_COMPONENTS="stc;html;aui;adv;core;net;base" -DwxLua_LUA_LIBRARY_USE_BUILTIN=FALSE -DwxLua_LUA_LIBRARY_VERSION=5.2 -DBUILD_USE_PRECOMPILED_HEADERS=FALSE -DCMAKE_CXX_FLAGS='-std=c++11 -stdlib=libc++ -Wno-c++11-narrowing' -DwxLua_LUA_LIBRARY_USE_BUILTIN=TRUE -DwxLua_LUA_LIBRARY_BUILD_SHARED=TRUE
@wuhao5
wuhao5 / wxwidget-clang
Last active August 29, 2015 14:04
wxWidget configure for Clang and C++11
./configure --prefix=`pwd`/install CC=clang CXX=clang++ CXXCPP="clang++ -E -std=c++11" --with-macosx-sdk=`xcrun --show-sdk-path` --enable-stl --with-expat=no --enable-unicode --with-osx_cocoa CFLAGS="-Os" CXXFLAGS="-Os -stdlib=libc++ -std=c++11" LDFLAGS="-stdlib=libc++ -flto" CPP="clang -E" OBJCXXFLAGS="-stdlib=libc++ -std=c++11" --with-libjpeg=builtin --with-libpng=builtin --with-libtiff=no --with-expat=no --with-zlib=builtin --disable-richtext --with-cocoa -with-macosx-version-min=10.7 --enable-compat28
mkdir -p lib
mkdir -p include
xcodebuild -target Box2D -sdk iphoneos -project Build/xcode5/Box2D.xcodeproj/ -configuration=Release -arch armv6 -arch armv7 -arch armv7s
xcodebuild -target Box2D -sdk iphonesimulator -project Build/xcode5/Box2D.xcodeproj/ -configuration=Release
lipo -create Build/xcode5/build/Release-iphoneos/libBox2D.a Build/xcode5/build/Release-iphonesimulator/libBox2D.a -o lib/libBox2D.a
find Box2D -name "*.h" -type f | while read line; do DIRNAME=`dirname $line`; mkdir -p include/$DIRNAME; cp $line include/$DIRNAME/.; done;