Alcaro / Flips

Floating IPS is a patcher for IPS and BPS files.
Other
309 stars 45 forks source link

Add install rules and metadata for GTK/Linux #27

Closed Kekun closed 4 years ago

Kekun commented 4 years ago

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.

Kekun commented 4 years ago

This is needed to have Flips on Flathub: https://github.com/flathub/flathub/pull/1345.

Alcaro commented 4 years ago

Remaining unresolved comments:

For anything else, I'll accept keeping it as is. Some of them are less than perfect, but they're good enough.

Kekun commented 4 years ago

Sorry I was pretty busy the last two weeks, but I have some time this weekend. :)

Makefile changes needed. In addition to the two I mentioned, the other makefile variables are uppercase, so let's do the same with prefix. And let's add an uninstall target.

Most makefile changes should be implemented now.

Regarding prefix, it's pretty standard and expected to be that way, so I'd rather not change it or calls to make would have to be manually tweaked. Same for DESTDIR.

Adding an uninstall target makes sense, sure. :)

Did the flathub guys say anything about what domain name to use?

I just replied int he thread: https://github.com/Alcaro/Flips/pull/27#discussion_r376700302.

That 178KB SVG is still there, didn't we deem it useless?

I forgot to push the updated commit removing it, it's now done. :)

The other SVGs seem outdated too

That should be fixed too.

Did we decide who to put as update contact? You know flatpak, but you don't have push access, so it's gonna be my problem anyways.

Fair enough, give me your email address and I'll use it, and you know where to find me for help.

Need to do something about the apply&run button

I'll try to fix that.

Better use make.sh

After re-reading the whole conversation I didn't find what that was about, can you remind me?

Another thing to do: add the MIME types in the desktop entry once https://gitlab.freedesktop.org/xdg/shared-mime-info/merge_requests/53 is accepted, but for that I need some UPS patch for the test suite, if you know where to find some I'm interested.

Alcaro commented 4 years ago

Regarding prefix, it's pretty standard and expected to be that way, so I'd rather not change it or calls to make would have to be manually tweaked. Same for DESTDIR.

Are you sure you're not mixing it up with ./configure --prefix=? I rarely see either make prefix= nor make PREFIX=.

If make prefix= does exist, consistency with other makefiles is more important than consistency with other local makefile variables, so let's keep it as is. (Though I still question how the convention ended up that way.)

give me your email address

https://github.com/Alcaro/Flips/pull/27#discussion_r370968688

After re-reading the whole conversation I didn't find what that was about, can you remind me?

make.sh does a lot of optimizations, including profile-guided. This makes the program ~2% faster, at the cost of increased compile time and memory use (2.5s 75MB -> 75s 900MB). Waste of time for development, but well worth it for anything intended to be distributed.

Either way, I pushed a change to let you add arbitrary flags to make.sh, rather than just relying on the hardcoded sets I added. Put your -DFLATPAK there.

Kekun commented 4 years ago

Regarding prefix vs PREFIX: I tried the uppercase version, it can't install because it tries to install to /usr, with the lowercase version, installing works because it tries to install to /app. So it seems Flatpak sets prefix to /app. TBH I've never seem the uppercase version anywhere while I did see the lowercase version since as long as I can remember. :/

Kekun commented 4 years ago

TODO:

Kekun commented 4 years ago

When building with make.sh from master I have this:

Running: sh make.sh --flatpak
GTK+ (1/3)
rm: cannot remove 'obj/*': No such file or directory
rm: cannot remove 'flips': No such file or directory
g++ flips-cli.cpp flips-w32.cpp libbps-suf.cpp libbps.cpp libips.cpp crc32.cpp libups.cpp flips.cpp flips-gtk.cpp -std=c++98 -fno-rtti -fno-exceptions -DNDEBUG -Wall -fopenmp -DFLIPS_GTK -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/lib/x86_64-linux-gnu/libffi-3.2.1/include -I/usr/include/harfbuzz -I/usr/include/fribidi -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -pthread -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0   -Ilibdivsufsort-2.0.1/include -DHAVE_CONFIG_H -D__STDC_FORMAT_MACROS libdivsufsort-2.0.1/lib/divsufsort.c libdivsufsort-2.0.1/lib/sssort.c libdivsufsort-2.0.1/lib/trsort.c   -Wall -Werror -O3 -flto -fuse-linker-plugin -fomit-frame-pointer -fmerge-all-constants -fvisibility=hidden -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -Wl,--gc-sections -fprofile-dir=obj/ -DFLATPAK -Wl,-z,relro,-z,now,--as-needed,--hash-style=gnu,--relax -fprofile-generate -lgcov -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -oflips
GTK+ (2/3)
make.sh: line 54: /usr/bin/time: No such file or directory
make.sh: line 55: /usr/bin/time: No such file or directory
GTK+ (3/3)
g++ flips-cli.cpp flips-w32.cpp libbps-suf.cpp libbps.cpp libips.cpp crc32.cpp libups.cpp flips.cpp flips-gtk.cpp -std=c++98 -fno-rtti -fno-exceptions -DNDEBUG -Wall -fopenmp -DFLIPS_GTK -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/lib/x86_64-linux-gnu/libffi-3.2.1/include -I/usr/include/harfbuzz -I/usr/include/fribidi -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -pthread -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0   -Ilibdivsufsort-2.0.1/include -DHAVE_CONFIG_H -D__STDC_FORMAT_MACROS libdivsufsort-2.0.1/lib/divsufsort.c libdivsufsort-2.0.1/lib/sssort.c libdivsufsort-2.0.1/lib/trsort.c   -Wall -Werror -O3 -flto -fuse-linker-plugin -fomit-frame-pointer -fmerge-all-constants -fvisibility=hidden -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -ffunction-sections -fdata-sections -Wl,--gc-sections -fprofile-dir=obj/ -DFLATPAK -Wl,-z,relro,-z,now,--as-needed,--hash-style=gnu,--relax -fprofile-use -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -oflips
libbps-suf.cpp: In member function ‘(anonymous namespace)::bps_creator::emit_source_read(unsigned long, unsigned long) [clone .isra.0]’:
libbps-suf.cpp:821:1: error: ‘obj//#run#build#flips#libbps-suf.gcda’ profile count data file not found [-Werror=missing-profile]
  821 | }
      | ^
cc1plus: all warnings being treated as errors
libbps.cpp: In function ‘bps_get_info’:
libbps.cpp:489:1: error: ‘obj//#run#build#flips#libbps.gcda’ profile count data file not found [-Werror=missing-profile]
  489 | }
      | ^
cc1plus: all warnings being treated as errors
libips.cpp: In function ‘ips_free(mem)’:
libips.cpp:356:1: error: ‘obj//#run#build#flips#libips.gcda’ profile count data file not found [-Werror=missing-profile]
  356 | }
      | ^
cc1plus: all warnings being treated as errors
crc32.cpp: In function ‘crc32_update(unsigned char const*, unsigned long, unsigned int)’:
crc32.cpp:21:1: error: ‘obj//#run#build#flips#crc32.gcda’ profile count data file not found [-Werror=missing-profile]
   21 | }
      | ^
cc1plus: all warnings being treated as errors
libups.cpp: In function ‘ups_free(mem)’:
libups.cpp:178:1: error: ‘obj//#run#build#flips#libups.gcda’ profile count data file not found [-Werror=missing-profile]
  178 | }
      | ^
cc1plus: all warnings being treated as errors
flips.cpp: In function ‘_GLOBAL__sub_I__Z13ReadWholeFilePKc’:
flips.cpp:1402:1: error: ‘obj//#run#build#flips#flips.gcda’ profile count data file not found [-Werror=missing-profile]
 1402 | }
      | ^
cc1plus: all warnings being treated as errors
flips-gtk.cpp: In function ‘ShowMessage(errorinfo) [clone .isra.0]’:
flips-gtk.cpp:1036:1: error: ‘obj//#run#build#flips#flips-gtk.gcda’ profile count data file not found [-Werror=missing-profile]
 1036 | }
      | ^
cc1plus: all warnings being treated as errors
libdivsufsort-2.0.1/lib/divsufsort.c: In function ‘sort_typeBstar(unsigned char const*, int*, int*, int*, int) [clone ._omp_fn.0]’:
libdivsufsort-2.0.1/lib/divsufsort.c:398:1: error: ‘obj//#run#build#flips#divsufsort.gcda’ profile count data file not found [-Werror=missing-profile]
  398 | }
      | ^
cc1plus: all warnings being treated as errors
libdivsufsort-2.0.1/lib/sssort.c: In function ‘sssort’:
libdivsufsort-2.0.1/lib/sssort.c:815:1: error: ‘obj//#run#build#flips#sssort.gcda’ profile count data file not found [-Werror=missing-profile]
  815 | }
      | ^
cc1plus: all warnings being treated as errors
libdivsufsort-2.0.1/lib/trsort.c: In function ‘trsort’:
libdivsufsort-2.0.1/lib/trsort.c:586:1: error: ‘obj//#run#build#flips#trsort.gcda’ profile count data file not found [-Werror=missing-profile]
  586 | }
      | ^
cc1plus: all warnings being treated as errors
make: *** [Makefile:104: flips] Error 1
Error: module flips: Le processus fils s’est terminé avec le code 2
Kekun commented 4 years ago

The MIME types got accepted in shared-mime-info, I already added them to the dektop entry: double clicking a .ips or .bps should launch Flips and open them with it. :)

Alcaro commented 4 years ago

make.sh: line 54: /usr/bin/time: No such file or directory

Well that's an interesting configuration.

Pushed a fix.

Kekun commented 4 years ago

It builds, thanks! I'm working on disabling the unusable functionalities in Flatpak, after this we should be all set.

Kekun commented 4 years ago

OK it should be ready now, if you find any issue let me know.

Alcaro commented 4 years ago

Good enough. Not exactly what I was thinking of, but it's easier if I fix the last few bits myself than ask about it.

Alcaro commented 4 years ago

Pushed, please check that f5b0164 didn't break anything that's not supposed to break.

Kekun commented 4 years ago

Shouldn't you replace this by a call to flatpakDisable()?

#ifdef FLATPAK
    gtk_widget_set_sensitive(button, false);
    gtk_widget_set_tooltip_text(button, "Running in emulators is not available in Flatpak");
#endif
Kekun commented 4 years ago

The build commands should be:

            "build-commands": [
                "sh make.sh --cflags=-DFLATPAK",
                "make install PREFIX=/app"
            ],

You can test what's on master on GitHub with this command: sudo flatpak-builder --system --install --force-clean build flatpak/com.github.Alcaro.Flips.json

Alcaro commented 4 years ago

Good points, fixed both.

Kekun commented 4 years ago

For Flips to be in Flatpak, all we need is a release or a tag: https://github.com/flathub/flathub/pull/1345#discussion_r376717975.

Alcaro commented 4 years ago

I'm afraid that will take a while, probably several years. I don't want to deem anything to be the final 1.4.0 until I've finished a bunch of stuff on the todo list, and I have trouble finding the necessary motivation. You're better off using latest master.

If it helps, I could tag some random commit as hello-flatpak-team, but that feels like a solution to wrong problem.