File: package_mac

package info (click to toggle)
musescore2 2.3.2%2Bdfsg4-15
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 168,212 kB
  • sloc: cpp: 262,317; xml: 176,707; sh: 3,377; ansic: 1,384; python: 356; makefile: 227; perl: 82; pascal: 78
file content (157 lines) | stat: -rwxr-xr-x 5,452 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/bin/bash

APPNAME=mscore
LONG_NAME=MuseScore

if [[ $1 ]]
then
    LONG_NAME=MuseScoreNightly
    LONGER_NAME=MuseScoreNightly
    VERSION=$1
else
    LONG_NAME=MuseScore
    LONGER_NAME="MuseScore 2"
    VERSION=2.3.2
fi

WORKING_DIRECTORY=applebuild
BACKGROUND=build/packaging/musescore-dmg-background.tiff
APP_PATH=applebuild/${APPNAME}.app

VOLNAME=${LONG_NAME}-${VERSION}
DMGNAME=${VOLNAME}Uncompressed.dmg
COMPRESSEDDMGNAME=${VOLNAME}.dmg


function set_bundle_display_options() {
	osascript <<-EOF
    tell application "Finder"
        set f to POSIX file ("${1}" as string) as alias
        tell folder f
            open
            tell container window
                set toolbar visible to false
                set statusbar visible to false
                set current view to icon view
                delay 1 -- sync
                set the bounds to {0, 0, 540, 300}
            end tell
            delay 1 -- sync
            set icon size of the icon view options of container window to 128
            set arrangement of the icon view options of container window to not arranged
            set position of item "${LONGER_NAME}.app" to {400,125}
            close
            open
            set position of item "Applications" to {150,125}
            close
            open
            set background picture of the icon view options of container window to file "background.tiff" of folder "Pictures"
            set the bounds of the container window to {0, 0, 540, 300}
            update without registering applications
            delay 5 -- sync
            close
        end tell
        delay 5 -- sync
    end tell
EOF

}

rm ${WORKING_DIRECTORY}/${COMPRESSEDDMGNAME}

#tip: increase the size if error on copy or macdeployqt
hdiutil create -size 400m -fs HFS+ -volname ${VOLNAME} ${WORKING_DIRECTORY}/${DMGNAME}

# Mount the disk image
hdiutil attach ${WORKING_DIRECTORY}/${DMGNAME}

# Obtain device information
DEVS=$(hdiutil attach ${WORKING_DIRECTORY}/${DMGNAME} | cut -f 1)
DEV=$(echo $DEVS | cut -f 1 -d ' ')
VOLUME=$(mount |grep ${DEV} | cut -f 3 -d ' ')

# copy in the application bundle
cp -Rp ${APP_PATH} ${VOLUME}/${APPNAME}.app

# fix the libs, qt5.1 has double slashes...
BIN_FILE=${VOLUME}/${APPNAME}.app/Contents/MacOS/mscore
for P in `otool -L $BIN_FILE | awk '{print $1}'`
do
    if [[ "$P" == *//* ]]
    then
        PSLASH=$(echo $P | sed 's,//,/,g')
        install_name_tool -change $P $PSLASH $BIN_FILE
        for P1 in `otool -L $PSLASH | awk '{print $1}'`
        do
            if [[ "$P1" == *//* ]]
            then
                PSLASH1=$(echo $P1 | sed 's,//,/,g')
                install_name_tool -change $P1 $PSLASH1 $PSLASH
            fi
        done
    fi
done

#homebrew libs may not be writable force it?
chmod -R +w /usr/local/Cellar/
macdeployqt ${VOLUME}/${APPNAME}.app

for f in $(find "${VOLUME}/${APPNAME}.app/Contents" -iname "*");
do
  lipo -remove ppc7400 "$f" -output "$f" > /dev/null 2>&1
  lipo -remove x86 "$f" -output "$f" > /dev/null 2>&1
  lipo -remove ppc "$f" -output "$f" > /dev/null 2>&1
done

rm -rf ${VOLUME}/${APPNAME}.app/Contents/PlugIns/mediaservice
rm -rf ${VOLUME}/${APPNAME}.app/Contents/PlugIns/audio
rm -rf ${VOLUME}/${APPNAME}.app/Contents/PlugIns/sqldrivers

rm -rf ${VOLUME}/${APPNAME}.app/Contents/Frameworks/Enginio.*
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Frameworks/QtBluetooth.*
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Frameworks/QtNfc.*
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Frameworks/QtLocation.*
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Frameworks/QtPurchasing.*
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Frameworks/QtQuickParticles.*
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Frameworks/QtWebEngine.*
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Frameworks/QtWebEngineCore.*
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Frameworks/QtScript.*
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Frameworks/QtScriptTools.*
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Frameworks/QtDeclarative.*

rm -rf ${VOLUME}/${APPNAME}.app/Contents/Resources/qml/Enginio
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Resources/qml/QtBluetooth
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Resources/qml/QtNfc
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Resources/qml/QtLocation
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Resources/qml/QtPositioning
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Resources/qml/QtPurchasing
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Resources/qml/QtQuick/Particles*
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Resources/qml/Qt/WebSockets
rm -rf ${VOLUME}/${APPNAME}.app/Contents/Resources/qml/QtWebEngine

mv ${VOLUME}/${APPNAME}.app "${VOLUME}/${LONGER_NAME}.app"

# copy in background image
mkdir -p ${VOLUME}/Pictures
# fixme: path
cp  ${BACKGROUND} ${VOLUME}/Pictures/background.tiff

# symlink applications
ln -s /Applications/ ${VOLUME}/Applications
set_bundle_display_options ${VOLUME}
mv ${VOLUME}/Pictures ${VOLUME}/.Pictures

#codesign
codesign --deep -s "Developer ID Application: MuseScore" "${VOLUME}/${LONGER_NAME}.app"
spctl --assess --type execute "${VOLUME}/${LONGER_NAME}.app"
codesign --verify --deep --strict --verbose=2 "${VOLUME}/${LONGER_NAME}.app"

# Unmount the disk image
hdiutil detach $DEV

# Convert the disk image to read-only
hdiutil convert ${WORKING_DIRECTORY}/${DMGNAME} -format UDBZ -o ${WORKING_DIRECTORY}/${COMPRESSEDDMGNAME}

shasum -a 256 ${WORKING_DIRECTORY}/${COMPRESSEDDMGNAME}

rm ${WORKING_DIRECTORY}/${DMGNAME}