Skip to content

Instantly share code, notes, and snippets.

@chux0519
Created December 18, 2020 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chux0519/492b68a56c32d9cd08f07c136666d214 to your computer and use it in GitHub Desktop.
Save chux0519/492b68a56c32d9cd08f07c136666d214 to your computer and use it in GitHub Desktop.
flameshot bundle script
#! /bin/bash
app_path=build/flameshot.app/Contents
bin_path="$app_path/MacOS"
CreateApp() {
rm -rf build/flameshot.app
mkdir -p $bin_path && cp build/src/flameshot $bin_path/flameshot
echo "<?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>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>flameshot</string>
<key>CFBundleGetInfoString</key>
<string>flameshot 0.0.0</string>
<key>CFBundleIconFile</key>
<string>flameshot.icns</string>
<key>CFBundleIdentifier</key>
<string>org.hexyoungs.club</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>flameshot</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0</string>
<key>CFBundleSignature</key>
<string>hexyoungs.club</string>
<key>CFBundleVersion</key>
<string>0.0.0</string>
<key>NSAppleScriptEnabled</key>
<string>YES</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
" > "$app_path/Info.plist"
}
CreateIcns() {
mkdir flameshot.iconset
sips -z 16 16 ./flameshotx1024.png --out flameshot.iconset/icon_16x16.png
sips -z 32 32 ./flameshotx1024.png --out flameshot.iconset/icon_16x16@2x.png
sips -z 32 32 ./flameshotx1024.png --out flameshot.iconset/icon_32x32.png
sips -z 64 64 ./flameshotx1024.png --out flameshot.iconset/icon_32x32@2x.png
sips -z 128 128 ./flameshotx1024.png --out flameshot.iconset/icon_128x128.png
sips -z 256 256 ./flameshotx1024.png --out flameshot.iconset/icon_128x128@2x.png
sips -z 256 256 ./flameshotx1024.png --out flameshot.iconset/icon_256x256.png
sips -z 512 512 ./flameshotx1024.png --out flameshot.iconset/icon_256x256@2x.png
sips -z 512 512 ./flameshotx1024.png --out flameshot.iconset/icon_512x512.png
cp ./flameshotx1024.png flameshot.iconset/icon_512x512@2x.png
iconutil -c icns flameshot.iconset
rm -R flameshot.iconset
mkdir "$app_path/Resources" && mv flameshot.icns "$app_path/Resources"
}
CopyDll() {
dlls=($(otool -L "$bin_path/flameshot" | grep local | cut -d " " -f 1))
for dll in "${dlls[@]}";
do
lib_name=($(basename $dll))
echo copying $lib_name
cp $dll $bin_path
install_name_tool -change $dll @executable_path/$lib_name $bin_path/flameshot
done
}
CreateApp && \
CreateIcns && \
CopyDll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment