]>
Commit | Line | Data |
---|---|---|
ad3c9f2a A |
1 | #!/bin/bash -e |
2 | ||
3 | if [ "$ACTION" = installhdrs ]; then exit 0; fi | |
5f125488 | 4 | if [ "${PLATFORM_NAME}" != "macosx" ]; then exit 0; fi |
b061a43b | 5 | if [ "${SKIP_MANPAGES}" = "YES" ]; then exit 0; fi |
507116e3 | 6 | if [ "${DRIVERKIT}" = 1 ]; then exit 0; fi |
ad3c9f2a A |
7 | |
8 | UNIFDEF_FLAGS=`${SRCROOT}/xcodescripts/generate_features.pl --unifdef` | |
9 | MANPAGES_LIST="${SRCROOT}/man/manpages.lst" | |
10 | FILES=$(find -E ${SRCROOT} -regex '.*/[^.]+\.[0-9]' -type f) | |
11 | ||
12 | cat ${MANPAGES_LIST} | grep -v -E '(^#|^\s*$)' | while read first solid rest; do | |
13 | SOURCE=$(grep -E "/${first}$"<<EOF | |
14 | ${FILES} | |
15 | EOF | |
16 | ) | |
6465356a A |
17 | |
18 | # This is a subshell, the real exit is after the loop. | |
19 | if [ -z "${SOURCE}" ]; then | |
20 | echo "Error: ${first} not found" | |
21 | exit 1 | |
22 | fi | |
23 | ||
ad3c9f2a A |
24 | SECTION=$(echo ${first} | tail -c 2) |
25 | ||
26 | DESTDIR=${DSTROOT}/usr/share/man/man${SECTION} | |
27 | DEST=${DESTDIR}/${solid} | |
28 | ||
29 | mkdir -p ${DSTROOT}/usr/share/man/man${SECTION} | |
30 | ||
31 | # cat is used to keep bash happy, unifdef returns non-zero in some success cases | |
32 | cmd="unifdef -t ${UNIFDEF_FLAGS} < ${SOURCE} | cat > ${DEST}" | |
33 | echo ${cmd} | |
34 | eval ${cmd} | |
35 | ||
36 | for link in ${rest}; do | |
37 | cmd="ln -sf ${first} ${DESTDIR}/${link}" | |
38 | echo ${cmd} | |
39 | eval ${cmd} | |
40 | done | |
41 | done | |
42 | ||
6465356a A |
43 | if [ $? -ne 0 ]; then |
44 | echo "Exiting due to previous error(s)." | |
45 | exit 1 | |
46 | fi | |
47 | ||
ad3c9f2a A |
48 | # grrr, uuid special case |
49 | for page in libuuid.3 uuid_clear.3 uuid_compare.3 uuid_copy.3 uuid_generate.3 uuid_is_null.3 uuid_parse.3 uuid_unparse.3; do | |
50 | SECTION=$(echo ${page} | tail -c 2) | |
51 | DESTDIR=${DSTROOT}/usr/share/man/man${SECTION} | |
52 | DEST=${DESTDIR}/${page} | |
53 | ||
54 | # libuuid.3 -> uuid.3 | |
55 | [[ "${page}" == "libuuid.3" ]] && DEST=${DESTDIR}/uuid.3 | |
56 | ||
57 | sed -f ${SRCROOT}/uuid/uuidman.sed ${SRCROOT}/uuid/uuidsrc/${page}.in > ${DEST} | |
58 | done | |
59 | ||
60 | # and because uuid pages are special cased, so are the links | |
61 | for link in uuid_generate_random.3 uuid_generate_time.3; do | |
62 | SECTION=$(echo ${link} | tail -c 2) | |
63 | ln -sf uuid_generate.3 ${DSTROOT}/usr/share/man/man${SECTION}/${link} | |
64 | done | |
65 | ||
66 | for link in uuid_unparse_lower.3 uuid_unparse_upper.3; do | |
67 | SECTION=$(echo ${link} | tail -c 2) | |
68 | ln -sf uuid_unparse.3 ${DSTROOT}/usr/share/man/man${SECTION}/${link} | |
69 | done |