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 aslcompiler.y accygwin.h acdragonfly.h \
22 acdragonflyex.h acefi.h acefiex.h achaiku.h acintel.h aclinux.h \
23 aclinuxex.h acmacosx.h acmsvc.h acmsvcex.h acnetbsd.h acos2.h \
24 acqnx.h acwin.h acwin64.h acwinex.h new_table.txt osbsdtbl.c \
25 osefitbl.c osefixf.c osfreebsdtbl.c oslinuxtbl.c osunixdir.c \
26 osunixmap.c oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c \
29 # include files to canonify
30 src_headers="acapps.h acbuffer.h acclib.h accommon.h acconfig.h \
31 acconvert.h acdebug.h acdisasm.h acdispat.h acevents.h \
32 acexcep.h acglobal.h achware.h acinterp.h aclocal.h acmacros.h \
33 acnames.h acnamesp.h acobject.h acopcode.h acoutput.h \
34 acparser.h acpi.h acpiosxf.h acpixf.h acpredef.h acresrc.h \
35 acrestyp.h acstruct.h actables.h actbinfo.h actbl.h actbl1.h \
36 actbl2.h actbl3.h actypes.h acutils.h acuuid.h amlcode.h \
37 amlresrc.h platform/acenv.h platform/acenvex.h \
38 platform/acfreebsd.h platform/acgcc.h"
39 comp_headers="aslcompiler.h asldefine.h aslglobal.h aslmessages.h \
40 aslsupport.l asltypes.h dtcompiler.h dttemplate.h preprocess.h"
41 platform_headers="acfreebsd.h acgcc.h"
51 tar -x -z -f ${src} -C ${wrk}
55 for i in ${stripdirs}; do
56 find ${wrk} -name ${i} -type d -print | xargs rm -r
58 for i in ${stripfiles}; do
59 find ${wrk} -name ${i} -type f -delete
63 echo copying full dirs
64 for i in ${fulldirs}; do
65 find ${wrk} -name ${i} -type d -print | xargs -J % mv % ${dst}
67 echo copying remaining files
68 find ${wrk} -type f -print | xargs -J % mv % ${dst}
70 # canonify include paths
71 for H in ${src_headers}; do
72 find ${dst} -name "*.[chly]" -type f -print | \
73 xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/$H\>|g"
75 for H in ${comp_headers}; do
76 find ${dst}/common ${dst}/compiler ${dst}/components \
77 -name "*.[chly]" -type f | \
78 xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/compiler/$H\>|g"
80 for H in ${platform_headers}; do
81 find ${dst}/include/platform -name "*.h" -type f -print | \
82 xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/platform/$H\>|g"
89 # assist the developer in generating a diff
90 echo "Directories you may want to 'svn diff':"
91 echo " sys/contrib/dev/acpica sys/dev/acpica \\"
92 echo " sys/amd64/acpica sys/arm64/acpica sys/i386/acpica sys/x86/acpica \\"
93 echo " sys/amd64/include sys/arm64/include sys/i386/include include \\"
94 echo " stand sys/conf sys/modules/acpi usr.sbin/acpi"