Skip to content

Instantly share code, notes, and snippets.

@iMokhles
Forked from kirb/README.md
Created September 17, 2012 09:04
Show Gist options
  • Save iMokhles/3736322 to your computer and use it in GitHub Desktop.
Save iMokhles/3736322 to your computer and use it in GitHub Desktop.
Theos on Windows

Theos on Windows

Instructions to follow soon...

ifeq ($(_THEOS_PLATFORM_LOADED),)
_THEOS_PLATFORM_LOADED := 1
THEOS_PLATFORM_NAME := cygwin
_THEOS_PLATFORM_DEFAULT_TARGET := iphone
_THEOS_PLATFORM_DU_EXCLUDE = --exclude
endif
#!/bin/bash
# Theos/iOS SDK 3.0 installer for Cygwin
# Mostly written by Ad@m <http://hbang.ws>
# Some from BigBoss' installsdk3 and installtheos3, included
# with the BigBoss Recommended Tools package.
# Big thanks to DHowett for his perl clone of dpkg-deb and
# dreadpiratepj for his iOS toolchain for Cygwin.
echo "*** Admin privileges required for this script. Press Ctrl-C now"
echo "*** if this script is being run without admin privileges."
## Checks
err=0
if [[ ! -f "/usr/bin/perl" ]]; then
echo "Please install perl using the Cygwin installer."
err=1
fi
if [[ ! -f "/usr/bin/make" ]]; then
echo "Please install make using the Cygwin installer."
err=1
fi
if [[ ! -f "/usr/bin/wget" ]]; then
echo "Please install wget using the Cygwin installer."
err=1
fi
if [[ ! -f "/usr/bin/tar" ]]; then
echo "Please install tar using the Cygwin installer."
err=1
fi
if [[ ! -f "/usr/bin/git" ]]; then
echo "Please install git using the Cygwin installer."
err=1
fi
[[ $err == 1 ]] && exit 1
## SDK
echo "Downloading SDK..."
if [[ ! -d "/opt/iphone-sdk-3.0/sysroot" ]]; then
wget http://thebigboss.org/hostedfiles/sdk3.tar.gz -O/tmp/sdk.tar.gz
mkdir -p /opt/iphone-sdk-3.0/sysroot
pushd /opt/iphone-sdk-3.0/sysroot
tar xfv /tmp/sdk.tar.gz
rm /tmp/sdk.tar.gz
popd
fi
## Symlinks
echo "Creating symlinks..."
pushd /opt/iphone-sdk-3.0/sysroot/usr/lib
ln -fs libgcc_s.1.dylib libgcc_s.10.5.dylib
ln -fs dylib1.o dylib1.10.5.o
ln -fs crt1.o crt1.10.5.o
ln -fs libstdc++.6.0.9.dylib libstdc++.6.dylib
ln -fs libstdc++.6.0.9.dylib libstdc++.dylib
ln -fs libobjc.A.dylib libobjc.dylib
ln -fs libSystem.B.dylib libSystem.dylib
popd
## Toolchain
echo "Downloading toolchain..."
if [[ ! -f "/usr/local/bin/arm-apple-darwin9-gcc" ]]; then
wget http://pjtrix.com/iphone/presentations/OSCON2009/iphone-toolchain-windows.tgz -O/tmp/toolchain.tgz
pushd /
tar xfv /tmp/toolchain.tgz
rm /tmp/toolchain.tgz
popd
ln -s /usr/local/bin/arm-apple-darwin9-gcc /usr/local/bin/arm-apple-darwin-gcc
fi
## Theos
echo "Downloading Theos..."
if [[ ! -d "/opt/theos" ]]; then
mkdir -p /opt
git clone git://github.com/DHowett/theos.git /opt/theos
fi
echo "Downloading Cygwin platform makefile..."
if [[ ! -f "/opt/theos/makefiles/platform/$(UNAME).mk" ]]; then
wget https://raw.github.com/gist/3731236/cygwin.mk -O/opt/theos/makefiles/platform/$(UNAME).mk --no-check-certificate
fi
echo "Downloading Cygwin target makefile..."
if [[ ! -d "/opt/theos/makefiles/targets/$(UNAME)" ]]; then
cp -r /opt/theos/makefiles/targets/linux /opt/theos/makefiles/targets/$(UNAME)
wget https://raw.github.com/gist/3731236/iphone.mk -O/opt/theos/makefiles/targets/$(UNAME)/iphone.mk --no-check-certificate
fi
## dpkg-deb
echo "Downloading dpkg-deb..."
if [[ ! -f "/usr/bin/dpkg-deb" ]]; then
wget http://uv.howett.net/~dhowett/dm.pl -O/usr/bin/dpkg-deb
chmod +x /usr/bin/dpkg-deb
fi
## ldid
echo "Downloading ldid..."
if [[ -f "/usr/bin/ldid.exe " ]]; then
wget http://www.hbang.ws/dl/ldid.exe -O/usr/bin/ldid.exe
chmod +x /usr/bin/ldid.exe
fi
## That's all, folks!
echo "Done!"
ifeq ($(_THEOS_TARGET_LOADED),)
_THEOS_TARGET_LOADED := 1
THEOS_TARGET_NAME := iphone
SDKTARGET ?= arm-apple-darwin9
SDKBINPATH ?= /usr/local/bin
SYSROOT ?= /opt/iphone-sdk-3.0/sysroot
PREFIX := $(SDKBINPATH)/$(SDKTARGET)-
TARGET_CC ?= $(PREFIX)gcc
TARGET_CXX ?= $(PREFIX)g++
TARGET_LD ?= $(PREFIX)g++
TARGET_STRIP ?= $(PREFIX)strip
TARGET_STRIP_FLAGS ?= -x
TARGET_CODESIGN_ALLOCATE ?= $(PREFIX)codesign_allocate
TARGET_CODESIGN ?= ldid
TARGET_CODESIGN_FLAGS ?= -S
include $(THEOS_MAKE_PATH)/targets/_common/install_deb_remote.mk
include $(THEOS_MAKE_PATH)/targets/_common/darwin.mk
include $(THEOS_MAKE_PATH)/targets/_common/darwin_flat_bundle.mk
TARGET_PRIVATE_FRAMEWORK_PATH = $(SYSROOT)/System/Library/PrivateFrameworks
SDKFLAGS := -isysroot $(SYSROOT)
TARGET_CFLAGS := $(SDKFLAGS) -I/usr/local/lib/gcc/arm-apple-darwin9/4.2.1/include
TARGET_LDFLAGS := $(SDKFLAGS) -multiply_defined suppress -bind_at_load
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment