]> git.xonotic.org Git - xonotic/netradiant.git/blob - library-bundler
bundle: export lib bundling code to a standalone script
[xonotic/netradiant.git] / library-bundler
1 #! /usr/bin/env bash
2
3 system_name="${1}"
4 exe_file="${2}"
5 bundle_dir="${3}"
6
7 case "${system_name}" in
8         'windows')
9                 bundle_dir="$(cygpath --unix "${bundle_dir}")"
10                 exe_file="$(cygpath --unix "${exe_file}")"
11                 ldd "${exe_file}" \
12                 | egrep -i '\.dll => /mingw64/' \
13                 | sed -e 's/ (0x[0-9a-f]*)$//;s/^.* => //' \
14                 | while read dll_file
15                 do
16                         dll_basename="$(basename "${dll_file}")"
17                         cp -n --preserve=timestamps "${dll_file}" "${bundle_dir}/${dll_basename}"
18                 done
19                 ;;
20         *)
21                 printf 'ERROR: unsupported system: %s\n' "${system_name}" >&2
22                 exit 1
23                 ;;
24 esac