diff options
Diffstat (limited to 'sys/contrib/dev/acpica/acpica_prep.sh')
-rwxr-xr-x | sys/contrib/dev/acpica/acpica_prep.sh | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/sys/contrib/dev/acpica/acpica_prep.sh b/sys/contrib/dev/acpica/acpica_prep.sh new file mode 100755 index 0000000..44f5e5e --- /dev/null +++ b/sys/contrib/dev/acpica/acpica_prep.sh @@ -0,0 +1,90 @@ +#!/bin/sh +# $FreeBSD$ +# +# Unpack an ACPI CA drop and restructure it to fit the FreeBSD layout +# + +if [ ! $# -eq 1 ]; then + echo "usage: $0 acpica_archive" + exit +fi + +src=$1 +wrk="$(realpath .)/_acpi_ca_unpack" +dst="$(realpath .)/acpi_ca_destination" + +# files that should keep their full directory path +fulldirs="common compiler components include os_specific" + +# files to remove +stripdirs="generate libraries tests tools" +stripfiles="Makefile README accygwin.h acefi.h achaiku.h acintel.h \ + aclinux.h acmacosx.h acmsvc.h acnetbsd.h acos2.h acwin.h \ + acwin64.h new_table.txt oslinuxtbl.c osunixdir.c oswindir.c \ + oswintbl.c oswinxf.c readme.txt utclib.c" + +# include files to canonify +src_headers="acapps.h acbuffer.h accommon.h acconfig.h acdebug.h \ + acdisasm.h acdispat.h acevents.h acexcep.h acglobal.h achware.h \ + acinterp.h aclocal.h acmacros.h acnames.h acnamesp.h acobject.h \ + acopcode.h acoutput.h acparser.h acpi.h acpiosxf.h acpixf.h \ + acpredef.h acresrc.h acrestyp.h acstruct.h actables.h actbl.h \ + actbl1.h actbl2.h actbl3.h actypes.h acutils.h amlcode.h \ + amlresrc.h platform/acenv.h platform/acfreebsd.h \ + platform/acgcc.h" +comp_headers="aslcompiler.h asldefine.h aslglobal.h aslmessages.h \ + aslsupport.l asltypes.h dtcompiler.h dttemplate.h preprocess.h" +platform_headers="acfreebsd.h acgcc.h" + +# pre-clean +echo pre-clean +rm -rf ${wrk} ${dst} +mkdir -p ${wrk} +mkdir -p ${dst} + +# unpack +echo unpack +tar -x -z -f ${src} -C ${wrk} + +# strip files +echo strip +for i in ${stripdirs}; do + find ${wrk} -name ${i} -type d -print | xargs rm -r +done +for i in ${stripfiles}; do + find ${wrk} -name ${i} -type f -delete +done + +# copy files +echo copying full dirs +for i in ${fulldirs}; do + find ${wrk} -name ${i} -type d -print | xargs -J % mv % ${dst} +done +echo copying remaining files +find ${wrk} -type f -print | xargs -J % mv % ${dst} + +# canonify include paths +for H in ${src_headers}; do + find ${dst} -name "*.[chly]" -type f -print | \ + xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/$H\>|g" +done +for H in ${comp_headers}; do + find ${dst}/common ${dst}/compiler ${dst}/components \ + -name "*.[chly]" -type f | \ + xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/compiler/$H\>|g" +done +for H in ${platform_headers}; do + find ${dst}/include/platform -name "*.h" -type f -print | \ + xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/platform/$H\>|g" +done + +# post-clean +echo post-clean +rm -rf ${wrk} + +# assist the developer in generating a diff +echo "Directories you may want to 'svn diff':" +echo " sys/contrib/dev/acpica sys/dev/acpica \\" +echo " sys/amd64/acpica sys/i386/acpica sys/ia64/acpica sys/x86/acpica \\" +echo " sys/amd64/include sys/i386/include sys/ia64/include \\" +echo " sys/boot sys/conf sys/modules/acpi usr.sbin/acpi" |