Implement plugin development environment support for linux
Stehfyn opened this issue · 5 comments
As of now, there only exists support for plugin development on windows which includes:
- Plugin Install script
- GIMP GI Typelib Sandbox environment script
GIMP 2.99 Development branch installs via flatpak and as such presents some obstacles for reaching parity with windows as far as setting up a workflow
Issues to solve:
Plugin Install:
-
Adding plugin folder to GIMP's plugin folder search paths (Needs to be done manually until workaround is created)#43 -
Installing .typelib/.so dependencies alongside GIMP's default typelibs (Could be done multiple ways)#43
Plugin Sandbox:
I don't think it would be that hard to set up a Python script to download GIMP and build it from source. I think that might take care of at least some of these issues.
I think that could help as far as bootstrapping us into getting a dev environment for the plugin for the time being if it's intuitive to get the gtknodes typelib/.so dependency going in it. It would be ideal to figure a way to work with flatpak as it is the promoted form of GIMP distribution for Unix-like.
There's two issues @parkern342 and I have run into with the flatpak installation of gimp.
- One must be running flatpak as superuser/root for our installed plugin to properly load. To test:
Frompictonode/gimp/pictonode-gimp-plugin/GIMP\ 2.99
we can install our plugin to the gimp flatpak install via
cp -r ./pictonode ~/.var/app/org.gimp.GIMP/config/GIMP/2.99/plug-ins
chmod -R 777 ~/.var/app/org.gimp.GIMP/config/GIMP/2.99/plug-ins/pictonode
but to actually have the plugin work we have to
sudo -s
before
flatpak run org.gimp.GIMP//beta
- We're still looking for how the gtknode .typelib/.so needs to be placed within whatever directories to get runtime access in our plugin via
import gi
gi.require_version("GtkNodes", "0.1")
from gi.repository import GtkNodes
GIMP's Windows directory structure is all self-contained and thus relatively straightforward, however the flatpak install appears be using directories from all over.
We think the path for the .typelib/.so is /var/lib/flatpak/app/org.gimp.GIMP/{arch}/beta/{some long hash}/files/lib
. Parker's been attempting to figure this one out and unsure of what he has tried.
Ah, I see.
One must be running flatpak as superuser/root for our installed plugin to properly load.
To me this smells like "flatpak runs everything as an external user that doesn't have permissions to run the .so
file". If the file permissions on the typelib
and so
are chmod 777
, does that fix anything? Obviously not a viable prod solution, but it might let us narrow down the issue.
We're still looking for how the gtknode .typelib/.so needs to be placed within whatever directories to get runtime access in our plugin
Is it feasible to do a manual override for this? As in, could we set GI_TYPELIB_PATH
and LD_LIBRARY_PATH
before loading gi
in our environment? This seemed to work on my end.
To me this smells like "flatpak runs everything as an external user that doesn't have permissions to run the
.so
file". If the file permissions on thetypelib
andso
arechmod 777
, does that fix anything? Obviously not a viable prod solution, but it might let us narrow down the issue.
After some testing it seems that you're right, and it seems to be why popular GIMP plugins are supported "flatpak extensions". It may be worthwhile sometime in the future to figure how to package our plugin as one, but for now I think it's best to just focus on getting something that is able to be developed/tested.
Is it feasible to do a manual override for this? As in, could we set
GI_TYPELIB_PATH
andLD_LIBRARY_PATH
before loadinggi
in our environment? This seemed to work on my end.
I wasn't sure what the ramifications were of manually overriding GI_TYPELIB_PATH
and LD_LIBRARY_PATH
in regards to other typelibs, so I dug into the docs and found:
GIRepository.Repository.prepend_search_path()
GIRepository.Repository.prepend_library_path()
After adding these to pictonode.py
with a quick GtkNodes.NodeView()
it's all dandy on my end as well and we now have access to GtkNodes at plugin runtime.
#43 includes an install script that should work with a non-superuser/root run of flatpak GIMP, as well as the changes to pictonode.py
Reopening as we still should have development sandbox support that doesn't require GIMP to be running. Should have something for this within the next couple of days