acpica_prep.sh revision 235945
190380Smsmith#!/bin/sh 290380Smsmith# $FreeBSD: head/sys/contrib/dev/acpica/acpica_prep.sh 235945 2012-05-24 23:12:30Z jkim $ 390380Smsmith# 490380Smsmith# Unpack an ACPI CA drop and restructure it to fit the FreeBSD layout 590380Smsmith# 690380Smsmith 798146Siwasakiif [ ! $# -eq 1 ]; then 898146Siwasaki echo "usage: $0 acpica_archive" 998146Siwasaki exit 1098146Siwasakifi 1198146Siwasaki 1290380Smsmithsrc=$1 13235945Sjkimwrk="$(realpath .)/_acpi_ca_unpack" 14235945Sjkimdst="$(realpath .)/acpi_ca_destination" 1590380Smsmith 16123333Snjl# files that should keep their full directory path 17231844Sjkimfulldirs="common compiler components include os_specific" 18193529Sjkim 1990380Smsmith# files to remove 20231844Sjkimstripdirs="generate libraries tests tools" 21193529Sjkimstripfiles="Makefile README acintel.h aclinux.h acmsvc.h acnetbsd.h \ 22228110Sjkim acos2.h accygwin.h acefi.h acwin.h acwin64.h osunixdir.c \ 23228110Sjkim oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c" 24193529Sjkim 25151946Sjkim# include files to canonify 26193529Sjkimsrc_headers="acapps.h accommon.h acconfig.h acdebug.h acdisasm.h \ 27193529Sjkim acdispat.h acevents.h acexcep.h acglobal.h achware.h acinterp.h \ 28193529Sjkim aclocal.h acmacros.h acnames.h acnamesp.h acobject.h acopcode.h \ 29193529Sjkim acoutput.h acparser.h acpi.h acpiosxf.h acpixf.h acpredef.h \ 30193529Sjkim acresrc.h acrestyp.h acstruct.h actables.h actbl.h actbl1.h \ 31228110Sjkim actbl2.h actbl3.h actypes.h acutils.h amlcode.h amlresrc.h \ 32197104Sjkim platform/acenv.h platform/acfreebsd.h platform/acgcc.h" 33213806Sjkimcomp_headers="aslcompiler.h asldefine.h aslglobal.h aslmessages.h \ 34234623Sjkim aslsupport.l asltypes.h dtcompiler.h dttemplate.h preprocess.h" 35193529Sjkimplatform_headers="acfreebsd.h acgcc.h" 3690380Smsmith 3790380Smsmith# pre-clean 3890380Smsmithecho pre-clean 39193529Sjkimrm -rf ${wrk} ${dst} 4090380Smsmithmkdir -p ${wrk} 4190380Smsmithmkdir -p ${dst} 4290380Smsmith 4390380Smsmith# unpack 4490380Smsmithecho unpack 4590380Smsmithtar -x -z -f ${src} -C ${wrk} 4690380Smsmith 4790380Smsmith# strip files 4890380Smsmithecho strip 4990380Smsmithfor i in ${stripdirs}; do 50209746Sjkim find ${wrk} -name ${i} -type d -print | xargs rm -r 5190380Smsmithdone 5290380Smsmithfor i in ${stripfiles}; do 53151946Sjkim find ${wrk} -name ${i} -type f -delete 5490380Smsmithdone 5590380Smsmith 56193529Sjkim# copy files 57123333Snjlecho copying full dirs 58123333Snjlfor i in ${fulldirs}; do 59209746Sjkim find ${wrk} -name ${i} -type d -print | xargs -J % mv % ${dst} 60123333Snjldone 61193529Sjkimecho copying remaining files 62209746Sjkimfind ${wrk} -type f -print | xargs -J % mv % ${dst} 6390380Smsmith 64151604Sobrien# canonify include paths 65151946Sjkimfor H in ${src_headers}; do 66220663Sjkim find ${dst} -name "*.[chly]" -type f -print | \ 67193529Sjkim xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/$H\>|g" 68151946Sjkimdone 69151946Sjkimfor H in ${comp_headers}; do 70235945Sjkim find ${dst}/common ${dst}/compiler ${dst}/components \ 71235945Sjkim -name "*.[chly]" -type f | \ 72151946Sjkim xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/compiler/$H\>|g" 73151946Sjkimdone 74193529Sjkimfor H in ${platform_headers}; do 75209746Sjkim find ${dst}/include/platform -name "*.h" -type f -print | \ 76193529Sjkim xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/platform/$H\>|g" 77193529Sjkimdone 78151604Sobrien 7990380Smsmith# post-clean 8090380Smsmithecho post-clean 8198146Siwasakirm -rf ${wrk} 82114244Snjl 83114244Snjl# assist the developer in generating a diff 84228110Sjkimecho "Directories you may want to 'svn diff':" 85228110Sjkimecho " sys/contrib/dev/acpica sys/dev/acpica \\" 86228110Sjkimecho " sys/amd64/acpica sys/i386/acpica sys/ia64/acpica sys/x86/acpica \\" 87228110Sjkimecho " sys/amd64/include sys/i386/include sys/ia64/include \\" 88228110Sjkimecho " sys/boot sys/conf sys/modules/acpi usr.sbin/acpi" 89