fix apple build

master
Marc Wäckerlin 7 years ago
parent fcb9bfbd6c
commit a89d46b9e1
  1. 62
      scripts/mac-create-app-bundle.sh

@ -7,7 +7,7 @@
## Parameters: ## Parameters:
## $1: name of the app-target ## $1: name of the app-target
## $2: name of the project ## $2: name of the project
## $3: installation source ## $3: package installation target
## ##
## 1 2 3 4 5 6 7 8 ## 1 2 3 4 5 6 7 8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890 ## 45678901234567890123456789012345678901234567890123456789012345678901234567890
@ -16,31 +16,33 @@ if test "$(uname -s)" != "Darwin"; then
echo "**** ERROR: run on Mac OS-X: $0" echo "**** ERROR: run on Mac OS-X: $0"
exit 1 exit 1
fi fi
test -n "$1"
test -n "$2" cd ${0%/*}
test -d "$3"
target="$(pwd)/${1}/Contents/MacOS" project=${2:-$(sed -n 's/ *m4_define *( *x_package_name, *\(.*\) *).*/\1/p' $(pwd)/configure.ac)}
apptarget=${1:-${project}.app}
sources=${3:-$(pwd)/usr}
test -n "$project"
test -d "$sources"
! test -e "$apptarget" || rm -rf "$apptarget"
target="$(pwd)/${apptarget}/Contents/MacOS"
echo "Creating $apptarget for $project from $sources"
# Step 1: create and fill app directory structure # Step 1: create and fill app directory structure
mkdir -p ${1}/Contents/{Resources,MacOS} mkdir -p ${apptarget}/Contents/{Resources,MacOS}
! test -d ${3}/bin || \ ! test -d ${sources}/bin || \
find ${3}/bin -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/MacOS/ \; find ${sources}/bin -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/MacOS/ \;
executablefile=$(ls -1 ${1}/Contents/MacOS/ | head -1) executablefile=${apptarget}/Contents/MacOS/${project}
! test -d ${3}/lib || \ test -x $executablefile || executablefile=$(ls -1 ${apptarget}/Contents/MacOS/ | head -1)
find ${3}/lib -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/MacOS/ \; ! test -d ${sources}/lib || \
! test -d ${3}/share/${2} || \ find ${sources}/lib -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/MacOS/ \;
find ${3}/share/${2} -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/Resources/ \; ! test -d ${sources}/share/${project} || \
! test -d ${3}/share/${2} || rmdir ${3}/share/${2} find ${sources}/share/${project} -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/Resources/ \;
! test -d ${3}/share || \ ! test -d ${sources}/share || \
find ${3}/share -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/Resources/ \; find ${sources}/share -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/Resources/ \;
! test -d ${3}/bin || rmdir ${3}/bin ! test -d ${sources} || \
! test -d ${3}/lib || rmdir ${3}/lib find ${sources} -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/Resources/ \;
! test -d ${3}/share || rmdir ${3}/share
! test -d ${3} || \
find ${3} -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/Resources/ \;
! test -d ${3}/include || rm -r ${3}/include
! test -d ${3} || rmdir ${3}
! test -d ${1}/tmp || rm -r ${1}/tmp
# Step 2: copy qt plugins, if necessary # Step 2: copy qt plugins, if necessary
for f in ${QT_PLUGINS}; do for f in ${QT_PLUGINS}; do
@ -79,23 +81,23 @@ if test -n "${QTDIR}"; then
MENU_NIB=$(find ${QTDIR} -name .svn -o -name .git -prune -o -name qt_menu.nib -print \ MENU_NIB=$(find ${QTDIR} -name .svn -o -name .git -prune -o -name qt_menu.nib -print \
| head -1) | head -1)
if test -e "${MENU_NIB}"; then if test -e "${MENU_NIB}"; then
rsync -r "${MENU_NIB}" ${1}/Contents/Resources/ rsync -r "${MENU_NIB}" ${apptarget}/Contents/Resources/
test -d ${1}/Contents/Resources/qt_menu.nib test -d ${apptarget}/Contents/Resources/qt_menu.nib
fi fi
fi fi
# Step 5: copy or create info.plist # Step 5: copy or create info.plist
infoplist=$(find ${1}/Contents/Resources -name Info.plist) infoplist=$(find ${apptarget}/Contents/Resources -name Info.plist)
if test -f "${infoplist}"; then if test -f "${infoplist}"; then
mv "${infoplist}" ${1}/Contents/Info.plist cp -a "${infoplist}" ${apptarget}/Contents/Info.plist
else else
cat > ${1}/Contents/Info.plist <<EOF cat > ${apptarget}/Contents/Info.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>${2}</string> <string>${project}</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>${executablefile##/}</string> <string>${executablefile##/}</string>
</dict> </dict>

Loading…
Cancel
Save