Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/sys/contrib/dev/acpica/acpica_prep.sh
48253 views
1
#!/bin/sh
2
# $FreeBSD$
3
#
4
# Unpack an ACPI CA drop and restructure it to fit the FreeBSD layout
5
#
6
7
if [ ! $# -eq 1 ]; then
8
echo "usage: $0 acpica_archive"
9
exit
10
fi
11
12
src=$1
13
wrk="$(realpath .)/_acpi_ca_unpack"
14
dst="$(realpath .)/acpi_ca_destination"
15
16
# files that should keep their full directory path
17
fulldirs="common compiler components include os_specific"
18
19
# files to remove
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 aczephyr.h new_table.txt \
25
osbsdtbl.c osefitbl.c osefixf.c osfreebsdtbl.c oslinuxtbl.c \
26
osunixdir.c osunixmap.c oswindir.c oswintbl.c oswinxf.c \
27
oszephyr.c readme.txt utclib.c utprint.c"
28
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"
42
43
# pre-clean
44
echo pre-clean
45
rm -rf ${wrk} ${dst}
46
mkdir -p ${wrk}
47
mkdir -p ${dst}
48
49
# unpack
50
echo unpack
51
tar -x -z -f ${src} -C ${wrk}
52
53
# strip files
54
echo strip
55
for i in ${stripdirs}; do
56
find ${wrk} -name ${i} -type d -print | xargs rm -r
57
done
58
for i in ${stripfiles}; do
59
find ${wrk} -name ${i} -type f -delete
60
done
61
62
# copy files
63
echo copying full dirs
64
for i in ${fulldirs}; do
65
find ${wrk} -name ${i} -type d -print | xargs -J % mv % ${dst}
66
done
67
echo copying remaining files
68
find ${wrk} -type f -print | xargs -J % mv % ${dst}
69
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"
74
done
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"
79
done
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"
83
done
84
85
# post-clean
86
echo post-clean
87
rm -rf ${wrk}
88
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"
95
96