Path: blob/main/sys/contrib/dev/acpica/acpica_prep.sh
48253 views
#!/bin/sh1# $FreeBSD$2#3# Unpack an ACPI CA drop and restructure it to fit the FreeBSD layout4#56if [ ! $# -eq 1 ]; then7echo "usage: $0 acpica_archive"8exit9fi1011src=$112wrk="$(realpath .)/_acpi_ca_unpack"13dst="$(realpath .)/acpi_ca_destination"1415# files that should keep their full directory path16fulldirs="common compiler components include os_specific"1718# files to remove19stripdirs="generate libraries parsers preprocessor tests tools"20stripfiles="Makefile README aslcompiler.y accygwin.h acdragonfly.h \21acdragonflyex.h acefi.h acefiex.h achaiku.h acintel.h aclinux.h \22aclinuxex.h acmacosx.h acmsvc.h acmsvcex.h acnetbsd.h acos2.h \23acqnx.h acwin.h acwin64.h acwinex.h aczephyr.h new_table.txt \24osbsdtbl.c osefitbl.c osefixf.c osfreebsdtbl.c oslinuxtbl.c \25osunixdir.c osunixmap.c oswindir.c oswintbl.c oswinxf.c \26oszephyr.c readme.txt utclib.c utprint.c"2728# include files to canonify29src_headers="acapps.h acbuffer.h acclib.h accommon.h acconfig.h \30acconvert.h acdebug.h acdisasm.h acdispat.h acevents.h \31acexcep.h acglobal.h achware.h acinterp.h aclocal.h acmacros.h \32acnames.h acnamesp.h acobject.h acopcode.h acoutput.h \33acparser.h acpi.h acpiosxf.h acpixf.h acpredef.h acresrc.h \34acrestyp.h acstruct.h actables.h actbinfo.h actbl.h actbl1.h \35actbl2.h actbl3.h actypes.h acutils.h acuuid.h amlcode.h \36amlresrc.h platform/acenv.h platform/acenvex.h \37platform/acfreebsd.h platform/acgcc.h"38comp_headers="aslcompiler.h asldefine.h aslglobal.h aslmessages.h \39aslsupport.l asltypes.h dtcompiler.h dttemplate.h preprocess.h"40platform_headers="acfreebsd.h acgcc.h"4142# pre-clean43echo pre-clean44rm -rf ${wrk} ${dst}45mkdir -p ${wrk}46mkdir -p ${dst}4748# unpack49echo unpack50tar -x -z -f ${src} -C ${wrk}5152# strip files53echo strip54for i in ${stripdirs}; do55find ${wrk} -name ${i} -type d -print | xargs rm -r56done57for i in ${stripfiles}; do58find ${wrk} -name ${i} -type f -delete59done6061# copy files62echo copying full dirs63for i in ${fulldirs}; do64find ${wrk} -name ${i} -type d -print | xargs -J % mv % ${dst}65done66echo copying remaining files67find ${wrk} -type f -print | xargs -J % mv % ${dst}6869# canonify include paths70for H in ${src_headers}; do71find ${dst} -name "*.[chly]" -type f -print | \72xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/$H\>|g"73done74for H in ${comp_headers}; do75find ${dst}/common ${dst}/compiler ${dst}/components \76-name "*.[chly]" -type f | \77xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/compiler/$H\>|g"78done79for H in ${platform_headers}; do80find ${dst}/include/platform -name "*.h" -type f -print | \81xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/platform/$H\>|g"82done8384# post-clean85echo post-clean86rm -rf ${wrk}8788# assist the developer in generating a diff89echo "Directories you may want to 'svn diff':"90echo " sys/contrib/dev/acpica sys/dev/acpica \\"91echo " sys/amd64/acpica sys/arm64/acpica sys/i386/acpica sys/x86/acpica \\"92echo " sys/amd64/include sys/arm64/include sys/i386/include include \\"93echo " stand sys/conf sys/modules/acpi usr.sbin/acpi"949596