Created
December 2, 2011 21:33
-
-
Save netshade/1424924 to your computer and use it in GitHub Desktop.
Compile libdispatch on Ubuntu from source
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install clang subversion autogen libtool pkg-config | |
svn co svn://mark.heily.com/libBlocksRuntime/trunk libBlocksRuntime | |
cd libBlocksRunTime | |
CC=clang ./configure | |
make | |
sudo cp libBlocksRuntime.so /usr/local/lib/ | |
sudo cp Block*.h /usr/local/include/ | |
cd .. | |
svn checkout svn://mark.heily.com/libkqueue/trunk libkqueue | |
cd libkqueue | |
./configure | |
sudo make install | |
cd .. | |
svn checkout svn://mark.heily.com/libpthread_workqueue/branches/stable libpthread_workqueue | |
cd libpthread_workqueue/ | |
./configure | |
make | |
sudo make install | |
cd .. | |
svn co http://svn.macosforge.org/repository/libdispatch/trunk/ libdispatch-linux | |
cd libdispatch-linux | |
cat /usr/include/unistd.h | sed 's/__block/ablock/g' > unistd.h | |
sh autogen.sh | |
CC=clang CFLAGS='-I/usr/local/include/kqueue/' LDFLAGS='-lm -lpthread_workqueue -lkqueue' ./configure | |
make | |
sudo make install | |
sudo ldconfig | |
cat <<EOSRC>test.c | |
#include <dispatch/dispatch.h> | |
#include <stdio.h> | |
int main() { | |
dispatch_queue_t q = dispatch_queue_create(NULL, NULL); | |
dispatch_sync(q, ^{ | |
printf("Libdispatch is working\n"); | |
}); | |
dispatch_release(q); | |
return 0; | |
} | |
EOSRC | |
clang -Wall -Werror -fblocks -L/usr/local/lib -I/usr/local/include -o test test.c -ldispatch | |
./test | |
cd testing | |
make check-TESTS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment