]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - sys/contrib/dev/acpica/acpica_prep.sh
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.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=./_acpi_ca_unpack
14 dst=./acpi_ca_destination
15
16 # files that should keep their full directory path
17 fulldirs="common compiler"
18 # files to remove
19 stripdirs="generate acpisrc"
20 stripfiles="16bit.h Makefile README a16find.c a16utils.asm a16utils.obj \
21         acdos16.h acintel.h aclinux.h acmsvc.h acnetbsd.h acpixtract.c  \
22         acwin.h acwin64.h aeexec.c aemain.c osdosxf.c osunixdir.c       \
23         oswindir.c oswinxf.c readme.txt"
24 # include files to canonify
25 src_headers="acapps.h acconfig.h acdebug.h acdisasm.h acdispat.h        \
26         acenv.h acevents.h acexcep.h acfreebsd.h acgcc.h acglobal.h     \
27         achware.h acinterp.h aclocal.h acmacros.h acnames.h acnamesp.h  \
28         acobject.h acopcode.h acoutput.h acparser.h acpi.h acpiosxf.h   \
29         acpixf.h acresrc.h acstruct.h actables.h actbl.h actbl1.h       \
30         actbl2.h actypes.h acutils.h aecommon.h amlcode.h amlresrc.h"
31 comp_headers="aslcompiler.h asldefine.h aslglobal.h asltypes.h"
32         
33 # files to update paths in
34 src_update_files="acpi.h acpiosxf.h"
35
36 # pre-clean
37 echo pre-clean
38 rm -rf ${wrk}
39 rm -rf ${dst}
40 mkdir -p ${wrk}
41 mkdir -p ${dst}
42
43 # unpack
44 echo unpack
45 tar -x -z -f ${src} -C ${wrk}
46
47 # strip files
48 echo strip
49 for i in ${stripdirs}; do
50         find ${wrk} -name ${i} -type d | xargs rm -r
51 done
52 for i in ${stripfiles}; do
53         find ${wrk} -name ${i} -type f -delete
54 done
55
56 echo copying full dirs
57 for i in ${fulldirs}; do
58         find ${wrk} -name ${i} -type d | xargs -J % mv % ${dst}
59 done
60
61 # move files to destination
62 echo copying flat dirs
63 find ${wrk} -type f | xargs -J % mv % ${dst}
64 mv ${dst}/changes.txt ${dst}/CHANGES.txt
65
66 # update src/headers for appropriate paths
67 echo updating paths
68 for i in ${src_update_files}; do
69         i=${dst}/$i
70         sed -e 's/platform\///' $i > $i.new && mv $i.new $i
71 done
72
73 # canonify include paths
74 for H in ${src_headers}; do
75         find ${dst} -name "*.[chy]" -type f |   \
76         xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/$H\>|g"
77 done
78 for H in ${comp_headers}; do
79         find ${dst}/compiler -name "*.[chly]" -type f | \
80         xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/compiler/$H\>|g"
81 done
82
83 # post-clean
84 echo post-clean
85 rm -rf ${wrk}
86
87 # assist the developer in generating a diff
88 echo "Directories you may want to 'cvs diff':"
89 echo "    src/sys/contrib/dev/acpica src/sys/dev/acpica \\"
90 echo "    src/sys/amd64/acpica src/sys/i386/acpica src/sys/ia64/acpica \\"
91 echo "    src/sys/amd64/include src/sys/i386/include src/sys/ia64/include \\"
92 echo "    src/sys/boot src/sys/conf src/sys/modules/acpi src/usr.sbin/acpi"