4 # Unpack an ACPI CA drop and restructure it to fit the FreeBSD layout
7 if [ ! $# -eq 1 ]; then
8 echo "usage: $0 acpica_archive"
13 wrk=`realpath ./_acpi_ca_unpack`
14 dst=`realpath ./acpi_ca_destination`
16 # files that should keep their full directory path
17 fulldirs="common compiler debugger disassembler dispatcher events \
18 executer hardware include namespace parser resources tables \
22 stripdirs="acpinames acpisrc acpixtract examples generate os_specific \
24 stripfiles="Makefile README acintel.h aclinux.h acmsvc.h acnetbsd.h \
25 acos2.h accygwin.h acefi.h acwin.h acwin64.h aeexec.c \
26 aehandlers.c aemain.c aetables.c aetables.h osunixdir.c \
29 # include files to canonify
30 src_headers="acapps.h accommon.h acconfig.h acdebug.h acdisasm.h \
31 acdispat.h acevents.h acexcep.h acglobal.h achware.h acinterp.h \
32 aclocal.h acmacros.h acnames.h acnamesp.h acobject.h acopcode.h \
33 acoutput.h acparser.h acpi.h acpiosxf.h acpixf.h acpredef.h \
34 acresrc.h acrestyp.h acstruct.h actables.h actbl.h actbl1.h \
35 actbl2.h actypes.h acutils.h amlcode.h amlresrc.h \
36 platform/acenv.h platform/acfreebsd.h platform/acgcc.h"
37 comp_headers="aslcompiler.h asldefine.h aslglobal.h aslmessages.h \
38 asltypes.h dtcompiler.h dttemplate.h"
39 platform_headers="acfreebsd.h acgcc.h"
49 tar -x -z -f ${src} -C ${wrk}
53 for i in ${stripdirs}; do
54 find ${wrk} -name ${i} -type d -print | xargs rm -r
56 for i in ${stripfiles}; do
57 find ${wrk} -name ${i} -type f -delete
61 echo copying full dirs
62 for i in ${fulldirs}; do
63 find ${wrk} -name ${i} -type d -print | xargs -J % mv % ${dst}
65 echo copying remaining files
66 find ${wrk} -type f -print | xargs -J % mv % ${dst}
68 # canonify include paths
69 for H in ${src_headers}; do
70 find ${dst} -name "*.[chly]" -type f -print | \
71 xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/$H\>|g"
73 for H in ${comp_headers}; do
74 find ${dst}/common ${dst}/compiler -name "*.[chly]" -type f | \
75 xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/compiler/$H\>|g"
77 for H in ${platform_headers}; do
78 find ${dst}/include/platform -name "*.h" -type f -print | \
79 xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/platform/$H\>|g"
86 # assist the developer in generating a diff
87 echo "Directories you may want to 'cvs diff':"
88 echo " src/sys/contrib/dev/acpica src/sys/dev/acpica \\"
89 echo " src/sys/amd64/acpica src/sys/i386/acpica src/sys/ia64/acpica \\"
90 echo " src/sys/amd64/include src/sys/i386/include src/sys/ia64/include \\"
91 echo " src/sys/boot src/sys/conf src/sys/modules/acpi src/usr.sbin/acpi"