summaryrefslogtreecommitdiff
path: root/Utilities/Scripts
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-23 13:33:05 -0400
committerBrad King <brad.king@kitware.com>2021-06-23 13:55:54 -0400
commit18038042ed16cfbc7515c42f01652c17f0d65dbc (patch)
tree761d4b3352a397eaf36d2a2af00a09720f03831a /Utilities/Scripts
parent6c5f21d10e51ce7ee6ba3f1579c68c558877fa63 (diff)
downloadcmake-18038042ed16cfbc7515c42f01652c17f0d65dbc.tar.gz
cmelf: Add script to import the FreeBSD ELF headers
These headers will be used to provide the ELF parsing code on all host operating systems (including those that don't have an ELF header, e.g. macOS). This will also allow removing various OS-dependent #ifdefs from the cmELF code. Add a script that was used to automate this import. Co-authored-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Diffstat (limited to 'Utilities/Scripts')
-rwxr-xr-xUtilities/Scripts/update-elf.bash28
1 files changed, 28 insertions, 0 deletions
diff --git a/Utilities/Scripts/update-elf.bash b/Utilities/Scripts/update-elf.bash
new file mode 100755
index 0000000000..1a065bad8b
--- /dev/null
+++ b/Utilities/Scripts/update-elf.bash
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+set -e
+set -x
+shopt -s dotglob
+
+readonly name="elf"
+readonly ownership="FreeBSD Upstream <kwrobot@kitware.com>"
+readonly subtree="Utilities/cmelf"
+readonly repo="https://github.com/freebsd/freebsd-src.git"
+readonly tag="main"
+readonly shortlog=false
+readonly paths="
+ sys/sys/elf32.h
+ sys/sys/elf64.h
+ sys/sys/elf_common.h
+"
+
+extract_source () {
+ git_archive
+ pushd "${extractdir}/${name}-reduced"
+ echo "* -whitespace" > .gitattributes
+ mv sys/sys/* .
+ sed -i -e 's/<sys\/elf_common.h>/"elf_common.h"/g' -e 's/u_int32_t/uint32_t/g' *.h
+ popd
+}
+
+. "${BASH_SOURCE%/*}/update-third-party.bash"