10 September 2009

Create your own GIMP Portable with simple batch command

While waiting the final release of Inkscape and upcoming MyPaint. I'm stumbled on few drawbacks of my unified Installer for All-in-One graphics OSS. Such problems are:

1. What if user have python already, should I force them to uninstall the conflicting one?
2. And if I tolerated it. What happen if they have Python Packages that newer or older?
3. What about mutiple different Python? Pythonpath?
4. Same thing for existing GTK Runtime/Devel that might be installed already and so on...



So I rethink how all these mess should be avoided. And came up with idea to isolate the suite altogether.
The Packages core are:
- Gimp
- Inkscape
- MyPaint
- Phatch
All bundled with shared GTK & Python + Docs + plugins but ripped translation (you may add it yourself)
In short that is another G.I.M.P heheh :)) and currently its nearly 70MB.

First Prepare your gimp... This could be longwinding explanation for a newbie. So I will skip it (as I will upload the whole package later), what you do is to make GIMP use GTK files. You could get Gimp and GTK files from general available installer on the net.

The isolation (aka portable) idea is kind of simple, GIMP batch loader will looks like:

REM gimp.cmd launcher by tumagonx
SET ROOTDIR=%~dp0Gimp\Bin\

REM This would make it multiuser based on username (in case you are not put it on flashdisk)
REM IF EXIST "%~dp0Userdata\%USERNAME%\tmp" GOTO runme ELSE GOTO init
REM :init
REM MKDIR "%~dp0Userdata\%USERNAME%\tmp"
REM :runme
REM SET HOMEPATH=%~dp0Userdata\%USERNAME%

REM rem below to make it multiuser
SET HOMEPATH=%~dp0Userdata

SET USERPROFILE=%HOMEPATH%
SET APPDATA=%HOMEPATH%
SET TMP=%HOMEPATH%\tmp
SET TEMP=%HOMEPATH%\tmp
SET PATH=%~dp0GTK\bin;%~dp0Python;%~dp0Python\Scripts;%WINDIR%\system32
CD %ROOTDIR%
START gimp-2.6

Directory structure should like this:

--Installation Folder
----Gimp
------Bin //-> Rootdir, where executable reside
------So on...
----Inkscape //-> Rootdir where executable exist
----Python //-> Shared (contain minimalistic python will all required packages)
----Userdata //-> All preference saved here
------tmp
----GTK //->Shared
----MyPaint
----So on...


Basically, it force apps to put user preference and anything else NOT in system default path. Also to avoid conflict I reset PATH so it contain just what the apps needed. All other environment thats not defined here will be available within system's original values.

There is two exception for GIMP:
- To make plugins work with separate GTK, you need modify Gimp\lib\gimp\2.0\environ\default.env into:

Path=..\..\GTK\bin

Don't worry that is relative path, it should be portable

- To make Python-Fu plugins work, specify correct python executable in GIMP\lib\gimp\2.0\interpreters\pygimp.interp into:

python=..\..\Python\pythonw.exe
/usr/bin/python=..\..\Python\pythonw.exe
:Python:E::py::python:


Done, now save and run gimp.cmd at top-level folder

This post is a bit foolish and obsolete look at here for updated info

No comments:

Post a Comment