darling/README.md

141 lines
4.9 KiB
Markdown
Raw Normal View History

2016-02-10 21:51:27 +00:00
# Darling
2015-12-18 16:13:15 +00:00
2016-02-10 21:47:38 +00:00
Darling is a runtime environment for OS X applications.
2015-12-18 16:13:15 +00:00
2016-02-10 21:47:38 +00:00
Please note that no GUI applications are supported at the moment.
2016-02-10 21:51:27 +00:00
## Download
2016-02-10 21:47:38 +00:00
Darling uses many Git submodules, so a plain clone will not do.
````
git clone https://github.com/darlinghq/darling.git
cd darling
git submodule init
git submodule update
````
Updating sources:
````
git pull
git submodule init
git submodule update
````
2016-02-10 21:51:27 +00:00
## Build Instructions
2015-12-18 16:13:15 +00:00
2016-02-11 08:57:41 +00:00
#### For running x86-64 OS X binaries
<a href="http://teamcity.dolezel.info/viewType.html?buildTypeId=Darling_DebianStableX8664&guest=1">
2016-02-11 08:57:41 +00:00
<img src="http://teamcity.dolezel.info/app/rest/builds/buildType:(id:Darling_DebianStableX8664)/statusIcon" title="Debian stable build for x86-64"/>
</a>
2015-12-18 16:13:15 +00:00
````
cd darling
mkdir -p build/x86-64
2016-02-25 03:09:25 +00:00
cd build/x86-64
2016-02-10 21:47:38 +00:00
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../Toolchain-x86_64.cmake
2015-12-18 16:13:15 +00:00
make
make install
# Now we go into src/lkm to build the kernel module
cd ../../src/lkm
make
make install
````
2016-02-10 21:47:38 +00:00
Required dependencies on Debian (stable): cmake clang bison flex linux-headers-amd64 xz-utils libfuse-dev libxml2-dev libicu-dev libssl-dev libbz2-dev zlib1g-dev libudev-dev
2016-02-11 08:57:41 +00:00
#### For running i386 OS X binaries
<a href="http://teamcity.dolezel.info/viewType.html?buildTypeId=Darling_DebianStableX8664&guest=1">
2016-02-11 08:57:41 +00:00
<img src="http://teamcity.dolezel.info/app/rest/builds/buildType:(id:Darling_DebianStableX8664)/statusIcon" title="Debian stable build for i386"/>
</a>
2015-12-18 16:13:15 +00:00
````
cd darling
mkdir -p build/i386
2016-02-25 03:09:25 +00:00
cd build/x86-64
2016-02-10 21:47:38 +00:00
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../Toolchain-x86.cmake
2015-12-18 16:13:15 +00:00
make
make install
````
2016-02-10 21:47:38 +00:00
Required additional dependencies on Debian (stable): libc6-dev-i386 libudev-dev:i386 lib32stdc++-4.9-dev
2015-12-18 16:13:15 +00:00
Loading the kernel module:
````
modprobe darling-mach
# ATTENTION: The kernel module is likely unstable,
# full of vulnerabilities, etc.
# You SHOULD restrict access to /dev/mach to trusted
# users only and be prepared to the eventuality of
# kernel hangups (and related data loss).
chmod a+rw /dev/mach
````
2016-02-10 21:51:27 +00:00
### Optional Features
2016-02-10 21:47:38 +00:00
Optionally, you can enable audio support with the ````-DFRAMEWORK_COREAUDIO=On````. This is still under development, so it probably only makes sense if you want to contribute.
This switch enables both ALSA and PulseAudio support by default, you can disable either of them with ````-DENABLE_ALSA=OFF```` or ````-DENABLE_PULSEAUDIO=OFF```` respectively.
Required dependencies on Debian (stable):
* x86-64: libpulse-dev libasound2-dev libavresample-dev libavformat-dev libavcodec-dev
* i386: libpulse-dev:i386 libasound2-dev:i386 libavresample-dev:i386 libavformat-dev:i386 libavcodec-dev:i386
Note that most of the above -dev packages conflict between x86-64 and i386, so if you build for both platforms, you have to reinstall the right -dev variants before every build. There should be no issues at runtime.
2016-02-10 21:51:27 +00:00
## Using Darling
2016-02-10 21:47:38 +00:00
Darling uses DPREFIXes, which are in essence similar to WINEPREFIXes. The are virtual chroot environment with an OS X-like filesystem hierarchy, where you can safely install and run software. Unless you set DPREFIX to your location, the default ````~/.darling```` is used.
The real root filesystem is available through ````/system-root```` and the ````/home```` directory is automatically symlinked, so you should feel at home right away.
At first use, initial prefix contents are downloaded from the Internet.
2016-02-10 21:51:27 +00:00
### Hello world
2016-02-10 21:47:38 +00:00
Let's start with a Hello world:
````
$ darling shell echo Hello world
Hello world
````
Congratulations, you have printed Hello world through Darling's OS X system call emulation and runtime libraries.
2016-02-10 21:51:27 +00:00
### Installing software
2016-02-10 21:47:38 +00:00
You can install ````.pkg```` packages with the installer tool available inside shell. It is a somewhat limited cousin of OS X's installer:
````
$ darling shell
Darling [~]$ installer -pkg mc-4.8.7-0.pkg -target /
````
If you have previously downloaded the Midnight Commander package from [Rudix](http://rudix.org), you can now run ````mc```` to start MC for OS X. Note that not all Rudix packages may work under Darling, namely the Rudix Package Manager doesn't work, as Darling doesn't yet build its own Python runtime.
You can uninstall and list packages with the ````uninstaller```` command.
2016-02-10 21:51:27 +00:00
### Working with DMG images
2016-02-10 21:47:38 +00:00
DMG images can be attached and deattached from inside ````darling shell```` with ````hdiutil````. This is how you can install Xcode along with its toolchain and SDKs (note that Xcode itself doesn't run yet):
````
Darling [~]$ hdiutil attach Xcode_7.2.dmg
/Volumes/Xcode_7.2
Darling [~]$ cp -r /Volumes/Xcode_7.2/Xcode.app /Applications
Darling [~]$ export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
Darling [~]$ echo 'void main() { puts("Hello world"); }' > helloworld.c
Darling [~]$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang helloworld.c -o helloworld
Darling [~]$ ./helloworld
Hello world
````
Congratulations, you have just compiled and run your own Hello world application with Apple's toolchain.