Add install rules and metadata for GTK/Linux

This allows to install Flips on Linux desktops, with all the modern
bells and whistles, like SVG icons, AppStream metadata, a flatpak
manifest, and the com.github.Alcaro.Flips reverse domain name app ID.
This commit is contained in:
Adrien Plazas
2020-01-25 13:05:10 +01:00
parent 1004a41f5d
commit f5823b43f2
10 changed files with 402 additions and 5 deletions

View File

@@ -17,6 +17,8 @@ XFILES :=
SOURCES := *.cpp
PREFIX ?= /usr
ifeq ($(TARGET),)
targetmachine := $(shell $(CXX) -dumpmachine)
ifneq ($(findstring mingw,$(targetmachine)),)
@@ -100,3 +102,29 @@ endif
$(FNAME_$(TARGET)): $(SOURCES) $(XFILES)
$(CXX) $^ -std=c++98 $(CFLAGS_G) $(MOREFLAGS) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) $(LFLAGS) -o$@
ifeq ($(TARGET),gtk)
install:
mkdir -p $(DESTDIR)$(PREFIX)/bin
mkdir -p $(DESTDIR)$(PREFIX)/share/applications
mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps
mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/symbolic/apps
mkdir -p $(DESTDIR)$(PREFIX)/share/metainfo
install -p -m755 $(FNAME_$(TARGET)) $(DESTDIR)$(PREFIX)/bin
install -p -m755 data/com.github.Alcaro.Flips.desktop $(DESTDIR)$(PREFIX)/share/applications
install -p -m644 data/com.github.Alcaro.Flips.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps
install -p -m644 data/com.github.Alcaro.Flips-symbolic.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/symbolic/apps
install -p -m644 data/com.github.Alcaro.Flips.metainfo.xml $(DESTDIR)$(PREFIX)/share/metainfo
uninstall:
mkdir -p $(DESTDIR)$(PREFIX)/bin
mkdir -p $(DESTDIR)$(PREFIX)/share/applications
mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps
mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/symbolic/apps
mkdir -p $(DESTDIR)$(PREFIX)/share/metainfo
rm $(DESTDIR)$(PREFIX)/bin/$(FNAME_$(TARGET))
rm $(DESTDIR)$(PREFIX)/share/applications/com.github.Alcaro.Flips.desktop
rm $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/com.github.Alcaro.Flips.svg
rm $(DESTDIR)$(PREFIX)/share/icons/hicolor/symbolic/apps/com.github.Alcaro.Flips-symbolic.svg
rm $(DESTDIR)$(PREFIX)/share/metainfo/com.github.Alcaro.Flips.metainfo.xml
endif

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16px"
height="16px"
viewBox="0 0 16 16"
version="1.1"
id="svg5"
sodipodi:docname="com.github.Alcaro.Flips-symbolic.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata11">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs9" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1376"
id="namedview7"
showgrid="false"
inkscape:zoom="64"
inkscape:cx="6.9695503"
inkscape:cy="5.0531077"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg5" />
<path
style="display:inline;opacity:1;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.87082338;enable-background:new"
d="M 3.5996094,0 C 4.4662794,0.8750003 6.1958288,4.17334 6.1992188,5.6875 6.1992188,8.104 4.39349,9 2,9 H 1 c 0.1570546,0.7500154 0.3963513,1.411808 0.6992188,2 H 5 l 3,3 3,-3 h 1.724609 C 13.523593,9.8664327 14,8.4901744 14,7 14,3.13428 10.82891,0 7,0 Z M 8,4 H 9 V 7 H 8 Z m 2,0 h 1 v 3 h -1 z m 1.601562,3.6992188 0.796876,0.6015624 C 10.828117,10.394531 9.17578,11.01172 8,11 6.74219,10.9883 5.93359,10.02344 6,9 V 8 h 1 v 1 c -0.0273,0.42187 0.25781,0.99219 1,1 0.82422,0.008 2.171874,-0.3945312 3.601562,-2.3007812 z"
id="path1286"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccsccccccsscccccccccccccccccccc" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path1288"
d="m 8,16 h 4.0003 L 16,12 h -4 z"
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 8,16 H 3.9997 L 0,12 h 4 z"
id="path1308"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,15 @@
[Desktop Entry]
Name=Flips
GenericName=Patcher
Comment=A patcher for IPS and BPS files
# Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=ips;bps;patcher;
Exec=flips %U
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
Icon=com.github.Alcaro.Flips
Terminal=false
X-GNOME-SingleWindow=true
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Utility;RevisionControl;
MimeType=application/x-bps-patch;application/x-ips-patch;

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2020 Adrien Plazas -->
<component type="desktop-application">
<id>com.github.Alcaro.Flips</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0+</project_license>
<name>Flips</name>
<summary>A patcher for IPS and BPS files</summary>
<description>
<p>
Flips is a patcher for IPS and BPS files, aiming for a simple interface
yet plenty of power under the hood.
</p>
</description>
<screenshots>
<screenshot type="default">
<image width="800" height="450">https://raw.githubusercontent.com/Alcaro/Flips/master/data/flips-main-window.png</image>
</screenshot>
<screenshot>
<image width="800" height="450">https://raw.githubusercontent.com/Alcaro/Flips/master/data/flips-preferences-window.png</image>
</screenshot>
</screenshots>
<releases>
<release version="1.3.1" date="2015-06-29"/>
</releases>
<provides>
<binary>flips</binary>
</provides>
<launchable type="desktop-id">com.github.Alcaro.Flips.desktop</launchable>
<url type="homepage">https://github.com/Alcaro/Flips</url>
<url type="bugtracker">https://github.com/Alcaro/Flips/issues</url>
<developer_name>Alcaro</developer_name>
<update_contact>floating_at_muncher.se</update_contact>
<content_rating type="oars-1.1"/>
</component>

View File

@@ -0,0 +1,194 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="128px"
height="128px"
viewBox="0 0 128 128"
version="1.1"
id="svg15"
sodipodi:docname="com.github.Alcaro.Flips.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata21">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs19" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1280"
inkscape:window-height="1376"
id="namedview17"
showgrid="false"
inkscape:zoom="3.3713595"
inkscape:cx="64.165618"
inkscape:cy="96.881391"
inkscape:window-x="1280"
inkscape:window-y="27"
inkscape:window-maximized="0"
inkscape:current-layer="svg15" />
<g
transform="translate(0,-172)"
style="display:inline;opacity:1;enable-background:new"
id="g1299">
<g
id="g1504">
<path
style="opacity:1;fill:#f5c211;fill-opacity:1;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 62,268 h 4 v 26 l -2,2 -2,-2 z"
id="rect1437"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccc" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
id="path1500"
d="m 62,268 h 4 v 8 h -4 z"
style="opacity:1;fill:#e5a50a;fill-opacity:1;stroke:none;stroke-width:3.77952766;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
<g
transform="matrix(-1,0,0,1,128,0)"
id="g1498">
<path
sodipodi:nodetypes="cccc"
style="fill:#e5a50a;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 64,296 29,-8 -7,-9 z"
id="path1484"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path1486"
d="m 108,262 -15,26 -7,-9 z"
style="fill:#f5c211;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
sodipodi:nodetypes="cccc" />
<path
inkscape:connector-curvature="0"
id="path1488"
d="m 64,296 15,-26 7,9 z"
style="fill:#f6d32d;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
sodipodi:nodetypes="cccc" />
<path
sodipodi:nodetypes="cccc"
style="fill:#f8e45c;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 108,262 -29,8 7,9 z"
id="path1490"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path1492"
d="M 108,262 84.25,276.75 86,279 Z"
style="fill:#f9f06b;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
sodipodi:nodetypes="cccc" />
<path
sodipodi:nodetypes="cccc"
style="fill:#f6d32d;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 108,262 87.75,281.25 86,279 Z"
id="path1494"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="cccc"
style="fill:#f8e45c;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 64,296 84.25,276.75 86,279 Z"
id="path1496"
inkscape:connector-curvature="0" />
</g>
<g
id="g1482">
<path
inkscape:connector-curvature="0"
id="path1388"
d="m 64,296 29,-8 -7,-9 z"
style="fill:#e5a50a;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
sodipodi:nodetypes="cccc" />
<path
sodipodi:nodetypes="cccc"
style="fill:#f5c211;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 108,262 -15,26 -7,-9 z"
id="path1390"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="cccc"
style="fill:#f6d32d;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 64,296 15,-26 7,9 z"
id="path1392"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path1394"
d="m 108,262 -29,8 7,9 z"
style="fill:#f8e45c;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
sodipodi:nodetypes="cccc" />
<path
sodipodi:nodetypes="cccc"
style="fill:#f9f06b;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 108,262 84.25,276.75 86,279 Z"
id="path1432"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path1434"
d="M 108,262 87.75,281.25 86,279 Z"
style="fill:#f6d32d;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
sodipodi:nodetypes="cccc" />
<path
inkscape:connector-curvature="0"
id="path1440"
d="M 64,296 84.25,276.75 86,279 Z"
style="fill:#f8e45c;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
sodipodi:nodetypes="cccc" />
</g>
<g
transform="matrix(6,0,0,6,19,176)"
id="g1445"
style="fill:#c01c28;fill-opacity:1">
<path
sodipodi:nodetypes="ccsccssc"
id="path1443"
d="M 3,0 C 4,1 5.996094,4.769531 6,6.5 6,9.261719 3.761719,10 1,10 H 0 c 0.78125,3.695312 3.222656,5.996094 7,6 4.417969,0 8,-3.582031 8,-8 C 15,3.582031 11.417969,0 7,0 Z"
style="fill:#c01c28;fill-opacity:1;fill-rule:nonzero;stroke:none"
inkscape:connector-curvature="0" />
</g>
<g
style="fill:#ed333b;fill-opacity:1"
id="g486"
transform="matrix(6,0,0,6,19,176)">
<path
inkscape:connector-curvature="0"
style="fill:#ed333b;fill-opacity:1;fill-rule:nonzero;stroke:none"
d="M 3,0 C 4,1 5.996094,4.769531 6,6.5 6,9.261719 3.761719,10 1,10 H 0 c 1.3333333,3.333333 3.222656,4.996094 7,5 4.417969,0 7.333333,-2.833333 8,-7 C 15,3.582031 11.417969,0 7,0 Z"
id="path484"
sodipodi:nodetypes="ccscccsc" />
</g>
<g
transform="matrix(6,0,0,6,19,176)"
id="g494"
style="fill:#241f31;fill-opacity:1">
<path
sodipodi:nodetypes="ccccccccccccccccccc"
id="path492"
d="M 8,5 H 9 V 8 H 8 Z m 2,0 h 1 v 3 h -1 z m 1.601562,3.699219 0.796876,0.601562 C 10.828125,11.394531 9.175781,12.011719 8,12 6.742188,11.988281 5.933594,11.023438 6,10 V 9 h 1 v 1 c -0.027344,0.421875 0.257812,0.992188 1,1 0.824219,0.0078 2.171875,-0.394531 3.601562,-2.300781 z"
style="fill:#241f31;fill-opacity:1;fill-rule:nonzero;stroke:none"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
data/flips-main-window.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@@ -0,0 +1,34 @@
{
"app-id" : "com.github.Alcaro.Flips",
"runtime" : "org.gnome.Platform",
"runtime-version" : "3.34",
"sdk" : "org.gnome.Sdk",
"command" : "flips",
"finish-args" : [
/* X11 + XShm access */
"--share=ipc",
"--socket=x11",
/* Wayland access */
"--socket=wayland",
/* OpenGL + DRI access */
"--device=dri",
/* Needed to find the ROMs and patches */
"--filesystem=host:ro"
],
"modules" : [
{
"name" : "flips",
"buildsystem" : "simple",
"build-commands": [
"sh make.sh --flatpak=yes",
"sh make.sh --flatpak=yes --install=yes"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/Alcaro/Flips.git"
}
]
}
]
}

View File

@@ -1033,6 +1033,7 @@ int GUIShow(const char * filename)
int main(int argc, char * argv[])
{
g_set_prgname("com.github.Alcaro.Flips");
canShowGUI = gtk_parse_args(&argc, &argv);
cfg.init_file(g_build_filename(g_get_user_config_dir(), "flipscfg", NULL));
return flipsmain(argc, argv);

26
make.sh
View File

@@ -2,6 +2,8 @@
#This script creates a heavily optimized Linux binary. For debugging or Windows, you're better off using the Makefile directly.
PREFIX=/usr
FLAGS='-Wall -Werror -O3 -flto -fuse-linker-plugin -fomit-frame-pointer -fmerge-all-constants -fvisibility=hidden'
FLAGS=$FLAGS' -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables'
FLAGS=$FLAGS' -ffunction-sections -fdata-sections -Wl,--gc-sections -fprofile-dir=obj/'
@@ -11,6 +13,8 @@ LINFLAGS=' -Wl,-z,relro,-z,now,--as-needed,--hash-style=gnu,--relax'
PROFILE=yes
INSTALL=no
for i in "$@"; do
case "$i" in
--harden=yes)
@@ -28,18 +32,30 @@ case "$i" in
;;
--harden=no|--profile=yes)
;;
--install=yes)
INSTALL=yes
;;
--flatpak=yes)
PREFIX=/app
FLAGS=$FLAGS" -DFLATPAK"
;;
*)
echo "Unknown argument $1; valid arguments are:"
echo "--harden=yes --profile=no --cflags=(...) --lflags=(...)"
echo "--harden=yes --profile=no --cflags=(...) --lflags=(...) --install=yes --flatpak=yes"
exit 1
;;
esac
done
if [ $PROFILE = yes ]; then
if [ $INSTALL = yes ]; then
echo 'GTK+ (install)'
TARGET=gtk make install PREFIX=$PREFIX || exit $?
elif [ $PROFILE = yes ]; then
echo 'GTK+ (1/3)'
rm obj/* flips; TARGET=gtk make CFLAGS="$FLAGS$LINFLAGS -fprofile-generate -lgcov" || exit $?
rm obj/* flips; TARGET=gtk make PREFIX=$PREFIX CFLAGS="$FLAGS$LINFLAGS -fprofile-generate -lgcov" || exit $?
[ -e flips ] || exit 1
echo 'GTK+ (2/3)'
@@ -55,7 +71,7 @@ $TIME ./flips --create --bps-delta profile/firefox-10.0esr.tar profile/f
$TIME ./flips --create --bps-delta-moremem profile/firefox-10.0esr.tar profile/firefox-17.0esr.tar /dev/null
echo 'GTK+ (3/3)'
rm flips; TARGET=gtk make CFLAGS="$FLAGS$LINFLAGS -fprofile-use" || exit $?
rm flips; TARGET=gtk make PREFIX=$PREFIX CFLAGS="$FLAGS$LINFLAGS -fprofile-use" || exit $?
else
rm flips; TARGET=gtk make CFLAGS="$FLAGS$LINFLAGS" || exit $?
rm flips; TARGET=gtk make PREFIX=$PREFIX CFLAGS="$FLAGS$LINFLAGS" || exit $?
fi