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 parsers preprocessor 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 acqnx.h \
24 acwin.h 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 utprint.c"
28 # include files to canonify
29 src_headers="acapps.h acbuffer.h acclib.h accommon.h acconfig.h \
30 acconvert.h acdebug.h acdisasm.h acdispat.h acevents.h \
31 acexcep.h acglobal.h achware.h acinterp.h aclocal.h acmacros.h \
32 acnames.h acnamesp.h acobject.h acopcode.h acoutput.h \
33 acparser.h acpi.h acpiosxf.h acpixf.h acpredef.h acresrc.h \
34 acrestyp.h acstruct.h actables.h actbl.h actbl1.h actbl2.h \
35 actbl3.h actypes.h acutils.h acuuid.h amlcode.h amlresrc.h \
36 platform/acenv.h platform/acenvex.h platform/acfreebsd.h \
38 comp_headers="aslcompiler.h asldefine.h aslglobal.h aslmessages.h \
39 aslsupport.l asltypes.h dtcompiler.h dttemplate.h preprocess.h"
40 platform_headers="acfreebsd.h acgcc.h"
50 tar -x -z -f ${src} -C ${wrk}
54 for i in ${stripdirs}; do
55 find ${wrk} -name ${i} -type d -print | xargs rm -r
57 for i in ${stripfiles}; do
58 find ${wrk} -name ${i} -type f -delete
62 echo copying full dirs
63 for i in ${fulldirs}; do
64 find ${wrk} -name ${i} -type d -print | xargs -J % mv % ${dst}
66 echo copying remaining files
67 find ${wrk} -type f -print | xargs -J % mv % ${dst}
69 # canonify include paths
70 for H in ${src_headers}; do
71 find ${dst} -name "*.[chly]" -type f -print | \
72 xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/$H\>|g"
74 for H in ${comp_headers}; do
75 find ${dst}/common ${dst}/compiler ${dst}/components \
76 -name "*.[chly]" -type f | \
77 xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/compiler/$H\>|g"
79 for H in ${platform_headers}; do
80 find ${dst}/include/platform -name "*.h" -type f -print | \
81 xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/platform/$H\>|g"
88 # assist the developer in generating a diff
89 echo "Directories you may want to 'svn diff':"
90 echo " sys/contrib/dev/acpica sys/dev/acpica \\"
91 echo " sys/amd64/acpica sys/arm64/acpica sys/i386/acpica sys/x86/acpica \\"
92 echo " sys/amd64/include sys/arm64/include sys/i386/include include \\"
93 echo " sys/boot sys/conf sys/modules/acpi usr.sbin/acpi"