-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path_blocks-runtime.sh
More file actions
42 lines (34 loc) · 1005 Bytes
/
_blocks-runtime.sh
File metadata and controls
42 lines (34 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
SRCDIR=$LLVM_STAGE2_SRC/compiler-rt/lib/BlocksRuntime
BUILDDIR=$BLOCKSRUNTIME_DIR-build
DESTDIR=$BLOCKSRUNTIME_DIR
rm -rf "$BUILDDIR"
mkdir -p "$BUILDDIR"
_pushd "$BUILDDIR"
cat << END > config.h
#ifndef _CONFIG_H_
#define _CONFIG_H_
#ifdef __APPLE__
#define HAVE_AVAILABILITY_MACROS_H 1
#define HAVE_TARGET_CONDITIONALS_H 1
#define HAVE_OSATOMIC_COMPARE_AND_SWAP_INT 1
#define HAVE_OSATOMIC_COMPARE_AND_SWAP_LONG 1
#define HAVE_LIBKERN_OSATOMIC_H
#endif
#if defined(__clang__)
#define HAVE_SYNC_BOOL_COMPARE_AND_SWAP_INT 1
#define HAVE_SYNC_BOOL_COMPARE_AND_SWAP_LONG 1
#endif
#endif
END
CFLAGS="$CFLAGS -O2 -I."
set -x
$CC $CFLAGS -fblocks -c "$SRCDIR/data.c" -o data.o
$CC $CFLAGS -fblocks -c "$SRCDIR/runtime.c" -o runtime.o
rm -f "$DESTDIR/lib/libBlocksRuntime.a"
mkdir -p "$DESTDIR/lib"
$AR crs "$DESTDIR/lib/libBlocksRuntime.a" data.o runtime.o
mkdir -p "$DESTDIR/usr/include"
cp "$SRCDIR/Block.h" "$DESTDIR/usr/include/Block.h"
set +x
_popd
$NO_CLEANUP || rm -rf "$BUILDDIR"