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 components include os_specific"
20 stripdirs="generate libraries tests tools"
21 stripfiles="Makefile README accygwin.h acdragonfly.h acdragonflyex.h \
22 acefi.h acefiex.h achaiku.h acintel.h aclinux.h aclinuxex.h \
23 acmacosx.h acmsvc.h acmsvcex.h acnetbsd.h acos2.h acwin.h \
24 acwin64.h acwinex.h new_table.txt osbsdtbl.c osefitbl.c \
25 osefixf.c osfreebsdtbl.c oslinuxtbl.c osunixdir.c osunixmap.c \
26 oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c"
28 # include files to canonify
29 src_headers="acapps.h acbuffer.h acclib.h accommon.h acconfig.h \
30 acdebug.h acdisasm.h acdispat.h acevents.h acexcep.h acglobal.h \
31 achware.h acinterp.h aclocal.h acmacros.h acnames.h acnamesp.h \
32 acobject.h acopcode.h acoutput.h acparser.h acpi.h acpiosxf.h \
33 acpixf.h acpredef.h acresrc.h acrestyp.h acstruct.h actables.h \
34 actbl.h actbl1.h actbl2.h actbl3.h actypes.h acutils.h acuuid.h \
35 amlcode.h amlresrc.h platform/acenv.h platform/acenvex.h \
36 platform/acfreebsd.h platform/acgcc.h"
37 comp_headers="aslcompiler.h asldefine.h aslglobal.h aslmessages.h \
38 aslsupport.l asltypes.h dtcompiler.h dttemplate.h preprocess.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 ${dst}/components \
75 -name "*.[chly]" -type f | \
76 xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/compiler/$H\>|g"
78 for H in ${platform_headers}; do
79 find ${dst}/include/platform -name "*.h" -type f -print | \
80 xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/platform/$H\>|g"
87 # assist the developer in generating a diff
88 echo "Directories you may want to 'svn diff':"
89 echo " sys/contrib/dev/acpica sys/dev/acpica \\"
90 echo " sys/amd64/acpica sys/i386/acpica sys/x86/acpica \\"
91 echo " sys/amd64/include sys/i386/include include \\"
92 echo " sys/boot sys/conf sys/modules/acpi usr.sbin/acpi"