]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/contrib/dev/acpica/acpica_prep.sh
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sys / contrib / dev / acpica / acpica_prep.sh
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 tests tools"
21 stripfiles="Makefile README accygwin.h acefi.h achaiku.h acintel.h      \
22         aclinux.h acmacosx.h acmsvc.h acnetbsd.h acos2.h acwin.h        \
23         acwin64.h new_table.txt osfreebsdtbl.c oslinuxtbl.c osunixdir.c \
24         osunixmap.c oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c"
25
26 # include files to canonify
27 src_headers="acapps.h acbuffer.h accommon.h acconfig.h acdebug.h        \
28         acdisasm.h acdispat.h acevents.h acexcep.h acglobal.h achware.h \
29         acinterp.h aclocal.h acmacros.h acnames.h acnamesp.h acobject.h \
30         acopcode.h acoutput.h acparser.h acpi.h acpiosxf.h acpixf.h     \
31         acpredef.h acresrc.h acrestyp.h acstruct.h actables.h actbl.h   \
32         actbl1.h actbl2.h actbl3.h actypes.h acutils.h amlcode.h        \
33         amlresrc.h platform/acenv.h platform/acfreebsd.h                \
34         platform/acgcc.h"
35 comp_headers="aslcompiler.h asldefine.h aslglobal.h aslmessages.h       \
36         aslsupport.l asltypes.h dtcompiler.h dttemplate.h preprocess.h"
37 platform_headers="acfreebsd.h acgcc.h"
38
39 # pre-clean
40 echo pre-clean
41 rm -rf ${wrk} ${dst}
42 mkdir -p ${wrk}
43 mkdir -p ${dst}
44
45 # unpack
46 echo unpack
47 tar -x -z -f ${src} -C ${wrk}
48
49 # strip files
50 echo strip
51 for i in ${stripdirs}; do
52         find ${wrk} -name ${i} -type d -print | xargs rm -r
53 done
54 for i in ${stripfiles}; do
55         find ${wrk} -name ${i} -type f -delete
56 done
57
58 # copy files
59 echo copying full dirs
60 for i in ${fulldirs}; do
61         find ${wrk} -name ${i} -type d -print | xargs -J % mv % ${dst}
62 done
63 echo copying remaining files
64 find ${wrk} -type f -print | xargs -J % mv % ${dst}
65
66 # canonify include paths
67 for H in ${src_headers}; do
68         find ${dst} -name "*.[chly]" -type f -print |   \
69         xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/$H\>|g"
70 done
71 for H in ${comp_headers}; do
72         find ${dst}/common ${dst}/compiler ${dst}/components \
73             -name "*.[chly]" -type f |  \
74         xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/compiler/$H\>|g"
75 done
76 for H in ${platform_headers}; do
77         find ${dst}/include/platform -name "*.h" -type f -print |       \
78         xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/platform/$H\>|g"
79 done
80
81 # post-clean
82 echo post-clean
83 rm -rf ${wrk}
84
85 # assist the developer in generating a diff
86 echo "Directories you may want to 'svn diff':"
87 echo "    sys/contrib/dev/acpica sys/dev/acpica \\"
88 echo "    sys/amd64/acpica sys/i386/acpica sys/ia64/acpica sys/x86/acpica \\"
89 echo "    sys/amd64/include sys/i386/include sys/ia64/include \\"
90 echo "    sys/boot sys/conf sys/modules/acpi usr.sbin/acpi"