8 changed files with 377 additions and 0 deletions
@ -0,0 +1,64 @@
@@ -0,0 +1,64 @@
|
||||
import os |
||||
import sys |
||||
import pathlib |
||||
import subprocess |
||||
|
||||
if len(sys.argv) < 2: |
||||
print("No path to original / hi-res icon provided") |
||||
raise SystemExit |
||||
|
||||
if len(sys.argv) > 2: |
||||
print("Too many arguments") |
||||
raise SystemExit |
||||
|
||||
originalPicture = sys.argv[1] |
||||
if not (os.path.isfile(originalPicture)): |
||||
print(f"There is no such file: {sys.argv[1]}") |
||||
raise SystemExit |
||||
|
||||
fname = pathlib.Path(originalPicture).stem |
||||
ext = pathlib.Path(originalPicture).suffix |
||||
destDir = pathlib.Path(originalPicture).parent |
||||
|
||||
iconsetDir = os.path.join(destDir, f"{fname}.iconset") |
||||
if not (os.path.exists(iconsetDir)): |
||||
pathlib.Path(iconsetDir).mkdir(parents=False, exist_ok=True) |
||||
|
||||
class IconParameters(): |
||||
width = 0 |
||||
scale = 1 |
||||
def __init__(self,width,scale): |
||||
self.width = width |
||||
self.scale = scale |
||||
def getIconName(self): |
||||
if self.scale != 1: |
||||
return f"icon_{self.width}x{self.width}{ext}" |
||||
else: |
||||
return f"icon_{self.width//2}x{self.width//2}@2x{ext}" |
||||
|
||||
# https://developer.apple.com/design/human-interface-guidelines/macos/icons-and-images/app-icon#app-icon-sizes |
||||
ListOfIconParameters = [ |
||||
IconParameters(16, 1), |
||||
IconParameters(16, 2), |
||||
IconParameters(32, 1), |
||||
IconParameters(32, 2), |
||||
IconParameters(64, 1), |
||||
IconParameters(64, 2), |
||||
IconParameters(128, 1), |
||||
IconParameters(128, 2), |
||||
IconParameters(256, 1), |
||||
IconParameters(256, 2), |
||||
IconParameters(512, 1), |
||||
IconParameters(512, 2), |
||||
IconParameters(1024, 1), |
||||
IconParameters(1024, 2) |
||||
] |
||||
|
||||
# generate iconset |
||||
for ip in ListOfIconParameters: |
||||
subprocess.call(["sips", "-z", str(ip.width), str(ip.width), originalPicture, "--out", os.path.join(iconsetDir, ip.getIconName())]) |
||||
#print(f"Generated {ip.getIconName()}") |
||||
|
||||
# convert iconset to icns file |
||||
subprocess.call(["iconutil", "-c", "icns", iconsetDir, "-o", os.path.join(destDir, f"{fname}.icns")]) |
||||
|
@ -0,0 +1,188 @@
@@ -0,0 +1,188 @@
|
||||
#! /bin/bash |
||||
|
||||
# Copyright (C) 2019-2020 Alexandros Theodotou <alex at zrythm dot org> |
||||
|
||||
# Notes: |
||||
# 1. This script assumes you have all the dependencies |
||||
# installed using HomeBrew. |
||||
# 2. Meant to be run from the parent dir |
||||
# 3. Uses appdmg (brew install npm, npm install -g appdmg) |
||||
# 4. need to install librsvg and then reinstall gdk-pixbuf |
||||
# in brew to get svg support (or copy the pixbuf loader from |
||||
# the Cellar of libtsvg to the Cellar of gdk-pixbuf) |
||||
|
||||
# args: |
||||
# 1: version |
||||
# 2: zrythm source root dir |
||||
# 3: prefix where zrythm was installed |
||||
# 4: path to copy finished installer to |
||||
# 5: osx data dir (tools/osx) |
||||
# 6: normal prefix (where other programs are installed) |
||||
|
||||
set -e |
||||
|
||||
ZRYTHM_VERSION=$1 |
||||
ZRYTHM_SRC_DIR=$2 |
||||
ZRYTHM_INSTALL_PREFIX=$3 |
||||
FINAL_DMG_PATH=$4 |
||||
OSX_SOURCE_DATA_DIR=$5 |
||||
NORMAL_PREFIX=$6 |
||||
WORK_ROOT=/tmp/zrythm-dmg |
||||
|
||||
rm -rf $WORK_ROOT |
||||
|
||||
# setup directory structure |
||||
APPDIR=$WORK_ROOT/Zrythm.app |
||||
Contents=$APPDIR/Contents |
||||
Resources=$Contents/Resources |
||||
Bin=$Resources/bin |
||||
Share=$Resources/share |
||||
Etc=$Resources/etc |
||||
Locale=$Resources/share/locale |
||||
Lib=$Resources/lib |
||||
|
||||
echo "system dependencies:" |
||||
for file in $ZRYTHM_INSTALL_PREFIX/bin/zrythm* ; do |
||||
if ! file $file | grep -qs Mach-O ; then |
||||
continue |
||||
fi |
||||
otool -L $file | awk '{print $1}' | egrep -v "(^$WORK_ROOT*)" |
||||
done | sort | uniq |
||||
|
||||
echo "Removing old $APPDIR tree ..." |
||||
rm -rf $APPDIR |
||||
|
||||
echo "Building new app directory structure ..." |
||||
mkdir -p $Contents/MacOS |
||||
mkdir -p $Etc |
||||
mkdir -p $Locale |
||||
mkdir -p $Lib |
||||
mkdir -p $Bin |
||||
|
||||
# copy static files |
||||
echo "copying plists" |
||||
sed "s/@VERSION@/$ZRYTHM_VERSION/" < \ |
||||
$OSX_SOURCE_DATA_DIR/Info.plist.in > $Contents/Info.plist |
||||
|
||||
cp $OSX_SOURCE_DATA_DIR/startup_script.sh $Contents/MacOS/Zrythm |
||||
chmod 775 $Contents/MacOS/Zrythm |
||||
MAIN_EXECUTABLE=zrythm ## used in startup_script |
||||
|
||||
echo "Copying zrythm executable ...." |
||||
cp $ZRYTHM_INSTALL_PREFIX/bin/zrythm $Bin/ |
||||
cp $OSX_SOURCE_DATA_DIR/zrythm.icns $Resources/ |
||||
|
||||
set +e # things below are not error-free (optional files etc) :( |
||||
|
||||
# |
||||
# Copy stuff that may be dynamically loaded |
||||
# |
||||
|
||||
# etc gtk |
||||
cp -RL $NORMAL_PREFIX/etc/gtk-3.0 $Etc/ |
||||
|
||||
# charset alias |
||||
cp -RL $NORMAL_PREFIX/lib/charset.alias $Lib/ |
||||
|
||||
# GDK Pixbuf |
||||
echo "copying gdk pixbuf loaders" |
||||
GDK_PIXBUF_DIR=gdk-pixbuf-2.0/2.10.0 |
||||
mkdir -p $Lib/$GDK_PIXBUF_DIR |
||||
cp -RL $NORMAL_PREFIX/lib/$GDK_PIXBUF_DIR/* $Lib/$GDK_PIXBUF_DIR/ |
||||
|
||||
# localization |
||||
echo "copying languages" |
||||
languages="fr de it es ja" |
||||
for lang in $languages; do |
||||
CUR_DIR="$Locale/$lang/LC_MESSAGES" |
||||
mkdir -p $CUR_DIR |
||||
cp $NORMAL_PREFIX/share/locale/$lang/zrythm.mo "$CUR_DIR/" |
||||
cp $NORMAL_PREFIX/share/locale/$lang/LC_MESSAGES/gtk30.mo \ |
||||
$NORMAL_PREFIX/share/locale/$lang/LC_MESSAGES/gtk30-properties.mo \ |
||||
$CUR_DIR/ |
||||
done |
||||
|
||||
echo "copying Adwaita icons" |
||||
ICONS_DIR="$Share/icons" |
||||
mkdir -p "$ICONS_DIR" |
||||
cp -RL "$NORMAL_PREFIX/share/icons/Adwaita" "$ICONS_DIR/" |
||||
|
||||
echo "copying existing hicolor icons" |
||||
cp -RL "$NORMAL_PREFIX/share/icons/hicolor" "$ICONS_DIR/" |
||||
|
||||
echo "copying app icon" |
||||
APPICON_DIR1=$ICONS_DIR/hicolor/scalable/apps |
||||
APPICON_DIR2=$ICONS_DIR/hicolor/48x48/apps |
||||
mkdir -p $APPICON_DIR1 |
||||
mkdir -p $APPICON_DIR2 |
||||
cp $ZRYTHM_SRC_DIR/resources/icons/zrythm/zrythm.svg $APPICON_DIR1/ |
||||
cp $ZRYTHM_SRC_DIR/resources/icons/zrythm/zrythm.svg $APPICON_DIR2/ |
||||
|
||||
echo "copying themes" |
||||
#rsync -a --copy-links /usr/local/share/ $Share/ |
||||
cp -RL "$NORMAL_PREFIX/share/themes" "$Share/" |
||||
|
||||
echo "copying fonts" |
||||
cp -R $ZRYTHM_SRC_DIR/data/fonts "$Share/" |
||||
|
||||
SCHEMAS_DIR="glib-2.0/schemas" |
||||
mkdir -p $Share/$SCHEMAS_DIR |
||||
cp $NORMAL_PREFIX/share/$SCHEMAS_DIR/org.zrythm*.xml \ |
||||
"$Share/$SCHEMAS_DIR/" |
||||
cp $NORMAL_PREFIX/share/$SCHEMAS_DIR/org.gtk.*.xml \ |
||||
"$Share/$SCHEMAS_DIR/" |
||||
echo "building schemas" |
||||
glib-compile-schemas "$Share/$SCHEMAS_DIR/" |
||||
|
||||
# copy libs |
||||
STDCPP='|libstdc\+\+' |
||||
while [ true ] ; do |
||||
missing=false |
||||
for file in $Bin/* $Lib/* ; do |
||||
if ! file $file | grep -qs Mach-O ; then |
||||
continue |
||||
fi |
||||
# libffi contains "S" (other section symbols) that should not be stripped. |
||||
if [[ $file == *"libffi"* ]] ; then |
||||
continue |
||||
fi |
||||
|
||||
if test x$STRIP != x ; then |
||||
strip -u -r -arch all $file &>/dev/null |
||||
fi |
||||
|
||||
deps=`otool -L $file | awk '{print $1}' | egrep "($NORMAL_PREFIX|libs/$STDCPP)" | grep -v "$(basename $file)"` |
||||
echo "deps=$deps" |
||||
# echo -n "." |
||||
for dep in $deps ; do |
||||
echo "dependency $dep" |
||||
base=`basename $dep` |
||||
if ! test -f $Lib/$base; then |
||||
if echo $dep | grep -sq '^libs' ; then |
||||
cp $WORK_ROOT/$dep $Lib |
||||
else |
||||
cp -L $dep $Lib |
||||
fi |
||||
missing=true |
||||
fi |
||||
done |
||||
done |
||||
if test x$missing = xfalse ; then |
||||
# everything has been found |
||||
break |
||||
fi |
||||
done |
||||
|
||||
# make dmg |
||||
echo "making dmg from .app" |
||||
rm -f $FINAL_DMG_PATH |
||||
mkdir -p $(dirname "$FINAL_DMG_PATH") |
||||
sed "s|@APP_PATH@|$APPDIR|" < \ |
||||
$OSX_SOURCE_DATA_DIR/appdmg.json.in > $WORK_ROOT/appdmg.json |
||||
sed -i -e "s|@ICNS_PATH@|$Resources/zrythm.icns|" \ |
||||
$WORK_ROOT/appdmg.json |
||||
cat $WORK_ROOT/appdmg.json |
||||
appdmg $WORK_ROOT/appdmg.json $FINAL_DMG_PATH |
||||
rm -f $WORK_ROOT/appdmg.json |
||||
echo "Done." |
||||
exit |
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//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>CFBundleDocumentTypes</key> |
||||
<array> |
||||
<dict> |
||||
<key>CFBundleTypeExtensions</key> |
||||
<array> |
||||
<string>zrythm</string> |
||||
</array> |
||||
<key>CFBundleTypeOSTypes</key> |
||||
<array> |
||||
<string>****</string> |
||||
<string>fold</string> |
||||
</array> |
||||
<key>CFBundleTypeRole</key> |
||||
<string>Editor</string> |
||||
<key>CFBundleTypeIconFile</key> |
||||
<string>zrythm.icns</string> |
||||
</dict> |
||||
</array> |
||||
<key>CFBundleExecutable</key> |
||||
<string>zrythm</string> |
||||
<key>CFBundleGetInfoString</key> |
||||
<string>@PACKAGE_VERSION@, (C) 2018-2020 Alexandros Theodotou https://www.zrythm.org</string> |
||||
<key>CFBundleIconFile</key> |
||||
<string>zrythm.icns</string> |
||||
<key>CFBundleIdentifier</key> |
||||
<string>org.zrythm.Zrythm</string> |
||||
<key>CFBundleInfoDictionaryVersion</key> |
||||
<string>6.0</string> |
||||
<key>CFBundleName</key> |
||||
<string>Zrythm</string> |
||||
<key>CFBundleDisplayName</key> |
||||
<string>Zrythm</string> |
||||
<key>CFBundlePackageType</key> |
||||
<string>APPL</string> |
||||
<key>CFBundleShortVersions</key> |
||||
<string>@PACKAGE_VERSION@</string> |
||||
<key>CFBundleSignature</key> |
||||
<string>????</string> |
||||
<key>CFBundleVersion</key> |
||||
<string>@PACKAGE_VERSION@</string> |
||||
<key>LSUIElement</key> |
||||
<string>0</string> |
||||
<key>NSMainNibFile</key> |
||||
<string>MainMenu</string> |
||||
<key>NSPrincipalClass</key> |
||||
<string>NSApplication</string> |
||||
<key>NSHumanReadableCopyright</key> |
||||
<string>Copyright 2018 - 2020 Alexandros Theodotou, GNU Affero General Public License, version 3 or later.</string> |
||||
<key>LSMinimumSystemVersion</key> |
||||
<string>10.4</string> |
||||
<key>GtkOSXLaunchScriptFile</key> |
||||
<string>gtk3-launcher.sh</string> |
||||
<key>NSHighResolutionCapable</key> |
||||
<true/> |
||||
</dict> |
||||
</plist> |
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
{ |
||||
"title": "Zrythm", |
||||
"icon": "@ICNS_PATH@", |
||||
"contents": [ |
||||
{ "x": 448, "y": 344, "type": "link", "path": "/Applications" }, |
||||
{ "x": 192, "y": 344, "type": "file", "path": "@APP_PATH@" } |
||||
] |
||||
} |
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh |
||||
|
||||
name=`basename "$0"` |
||||
tmp="$0" |
||||
tmp=`dirname "$tmp"` |
||||
tmp=`dirname "$tmp"` |
||||
bundle=`dirname "$tmp"` |
||||
bundle_contents="$bundle"/Contents |
||||
bundle_res="$bundle_contents"/Resources |
||||
bundle_lib="$bundle_res"/lib |
||||
bundle_bin="$bundle_res"/bin |
||||
bundle_data="$bundle_res"/share |
||||
bundle_etc="$bundle_res"/etc |
||||
|
||||
export XDG_DATA_DIRS="$bundle_data" |
||||
export GTK_DATA_PREFIX="$bundle_res" |
||||
export GTK_EXE_PREFIX="$bundle_res" |
||||
export GTK_PATH="$bundle_res" |
||||
|
||||
export GDK_PIXBUF_MODULE_FILE="$bundle_lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" |
||||
|
||||
I18NDIR="$bundle_data/locale" |
||||
|
||||
# Strip out the argument added by the OS. |
||||
if /bin/expr "x$1" : '^x-psn_' > /dev/null; then |
||||
shift 1 |
||||
fi |
||||
|
||||
export GDK_DEBUG=interactive |
||||
|
||||
exec "$bundle_bin/zrythm" "$@" |
Binary file not shown.
Loading…
Reference in new issue