cross compilation with qemu enabled

This commit is contained in:
Marc Wäckerlin
2018-08-21 14:32:20 +00:00
parent 470797c758
commit 8ad42e23cc
9 changed files with 2832 additions and 57 deletions

View File

@@ -17,14 +17,12 @@ if test "$(uname -s)" != "Darwin"; then
exit 1
fi
cd ${0%/*}
project=${2:-$(sed -n 's/ *m4_define *( *x_package_name, *\(.*\) *).*/\1/p' $(pwd)/configure.ac)}
apptarget=${1:-${project}.app}
sources=${3:-$(pwd)/usr}
sources=${3:-$(pwd)/tmp}
! test -e "$apptarget" || rm -rf "$apptarget"
test -n "$project"
test -d "$sources"
! test -e "$apptarget" || rm -rf "$apptarget"
target="$(pwd)/${apptarget}/Contents/MacOS"
echo "Creating $apptarget for $project from $sources"
@@ -32,7 +30,9 @@ echo "Creating $apptarget for $project from $sources"
# Step 1: create and fill app directory structure
mkdir -p ${apptarget}/Contents/{Resources,MacOS}
! test -d ${sources}/bin || \
find ${sources}/bin -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/MacOS/ \;
find ${sources}/bin -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/MacOS/ \;
! test -d ${sources}/scripts || \
find ${sources}/scripts -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/MacOS/ \;
executablefile=${apptarget}/Contents/MacOS/${project}
test -x $executablefile || executablefile=$(ls -1 ${apptarget}/Contents/MacOS/ | head -1)
! test -d ${sources}/lib || \
@@ -40,9 +40,9 @@ test -x $executablefile || executablefile=$(ls -1 ${apptarget}/Contents/MacOS/ |
! test -d ${sources}/share/${project} || \
find ${sources}/share/${project} -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/Resources/ \;
! test -d ${sources}/share || \
find ${sources}/share -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/Resources/ \;
find ${sources}/share -mindepth 1 -maxdepth 1 -name ${project} -prune -o -exec cp -a {} ${apptarget}/Contents/Resources/ \;
! test -d ${sources} || \
find ${sources} -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/Resources/ \;
find ${sources} -mindepth 1 -maxdepth 1 -name share -o -name bin -o -name lib -o -name scripts -prune -o -exec cp -a {} ${apptarget}/Contents/Resources/ \;
# Step 2: copy qt plugins, if necessary
for f in ${QT_PLUGINS}; do
@@ -59,7 +59,7 @@ while [ $found -ne 0 ]; do
cd "${target}"
for file in $(find . -type f); do
for lib in $(otool -L ${file} | tail -n +2 \
| egrep '/opt/local/|'"${HOME}" \
| egrep '/usr/local/|/opt/local/|'"${HOME}" \
| grep -v $file | awk '{print $1}'); do
found=1
test -f ${lib##*/} \
@@ -86,20 +86,19 @@ if test -n "${QTDIR}"; then
fi
fi
# Step 5: copy or create info.plist
infoplist=$(find ${apptarget}/Contents/Resources -name Info.plist)
if test -f "${infoplist}"; then
cp -a "${infoplist}" ${apptarget}/Contents/Info.plist
# Step 5: copy local or create new info.plist
if test -f Info.plist; then
cp -a Info.plist ${apptarget}/Contents/Info.plist
else
cat > ${apptarget}/Contents/Info.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<qdict>
<key>CFBundleIdentifier</key>
<string>${project}</string>
<key>CFBundleExecutable</key>
<string>${executablefile##/}</string>
<string>${executablefile##*/}</string>
</dict>
</plist>
EOF