xref: /xnu-10063.121.3/config/list_supported.sh (revision 2c2f96dc2b9a4408a43d3150ae9c105355ca3daa)
1*2c2f96dcSApple OSS Distributions#!/bin/bash
2*2c2f96dcSApple OSS Distributions
3*2c2f96dcSApple OSS Distributions#
4*2c2f96dcSApple OSS Distributions# Copyright (c) 2008 Apple Inc. All rights reserved.
5*2c2f96dcSApple OSS Distributions#
6*2c2f96dcSApple OSS Distributions# @APPLE_OSREFERENCE_LICENSE_HEADER_START@
7*2c2f96dcSApple OSS Distributions#
8*2c2f96dcSApple OSS Distributions# This file contains Original Code and/or Modifications of Original Code
9*2c2f96dcSApple OSS Distributions# as defined in and that are subject to the Apple Public Source License
10*2c2f96dcSApple OSS Distributions# Version 2.0 (the 'License'). You may not use this file except in
11*2c2f96dcSApple OSS Distributions# compliance with the License. Please obtain a copy of the License at
12*2c2f96dcSApple OSS Distributions# http://www.opensource.apple.com/apsl/ and read it before using this
13*2c2f96dcSApple OSS Distributions# file.
14*2c2f96dcSApple OSS Distributions#
15*2c2f96dcSApple OSS Distributions# The Original Code and all software distributed under the License are
16*2c2f96dcSApple OSS Distributions# distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17*2c2f96dcSApple OSS Distributions# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18*2c2f96dcSApple OSS Distributions# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19*2c2f96dcSApple OSS Distributions# FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20*2c2f96dcSApple OSS Distributions# Please see the License for the specific language governing rights and
21*2c2f96dcSApple OSS Distributions# limitations under the License.
22*2c2f96dcSApple OSS Distributions#
23*2c2f96dcSApple OSS Distributions# @APPLE_OSREFERENCE_LICENSE_HEADER_END@
24*2c2f96dcSApple OSS Distributions#
25*2c2f96dcSApple OSS Distributions# list_supported.sh <directory with .exports files> <lower case architecture> <target file>
26*2c2f96dcSApple OSS Distributions
27*2c2f96dcSApple OSS DistributionsCONFIG_DIR=$1
28*2c2f96dcSApple OSS DistributionsARCH=$2
29*2c2f96dcSApple OSS DistributionsTARGET_FILE=$3
30*2c2f96dcSApple OSS Distributions
31*2c2f96dcSApple OSS DistributionsSUPPORTED_KPI_FILES=( BSDKernel Mach IOKit Libkern )
32*2c2f96dcSApple OSS DistributionsDEPENDENCY_NAMES=( com.apple.kpi.bsd com.apple.kpi.mach com.apple.kpi.iokit com.apple.kpi.libkern )
33*2c2f96dcSApple OSS Distributions
34*2c2f96dcSApple OSS Distributionsrm -f ${TARGET_FILE}
35*2c2f96dcSApple OSS Distributions
36*2c2f96dcSApple OSS Distributionsif [ ${ARCH} == "all" ]
37*2c2f96dcSApple OSS Distributionsthen
38*2c2f96dcSApple OSS Distributions	echo "The following symbols are considered sustainable KPI on all architectures." >> ${TARGET_FILE}
39*2c2f96dcSApple OSS Distributions	echo "Note that symbols may be exported by some (or all) architectures individually." >> ${TARGET_FILE}
40*2c2f96dcSApple OSS Distributionselse
41*2c2f96dcSApple OSS Distributions	echo "The following symbols are considered sustainable KPI on architecture ${ARCH}." >> ${TARGET_FILE}
42*2c2f96dcSApple OSS Distributionsfi
43*2c2f96dcSApple OSS Distributionsecho  >> ${TARGET_FILE}
44*2c2f96dcSApple OSS Distributions
45*2c2f96dcSApple OSS Distributionsfor (( i = 0 ; i < ${#SUPPORTED_KPI_FILES[@]} ; i++ ))
46*2c2f96dcSApple OSS Distributionsdo
47*2c2f96dcSApple OSS Distributions	echo "Exported by ${DEPENDENCY_NAMES[i]}:" >> ${TARGET_FILE}
48*2c2f96dcSApple OSS Distributions	echo >> ${TARGET_FILE}
49*2c2f96dcSApple OSS Distributions	if [  ${ARCH} == "all" ]
50*2c2f96dcSApple OSS Distributions	then
51*2c2f96dcSApple OSS Distributions		cat "${CONFIG_DIR}/${SUPPORTED_KPI_FILES[i]}.exports" | sed "s/^_//" | sed "s/:.*//" | sort >> ${TARGET_FILE}
52*2c2f96dcSApple OSS Distributions	else
53*2c2f96dcSApple OSS Distributions		cat "${CONFIG_DIR}/${SUPPORTED_KPI_FILES[i]}.${ARCH}.exports" | sed "s/^_//" | sed "s/:.*//" | sort  >> ${TARGET_FILE}
54*2c2f96dcSApple OSS Distributions	fi
55*2c2f96dcSApple OSS Distributions	echo >> ${TARGET_FILE}
56*2c2f96dcSApple OSS Distributionsdone
57