2013年4月7日日曜日

Windows7 64bitでgimp2.8.4、gimp2.9~、gimp-painterをビルド(その2)


前回の続き。

いろいろやっていた気づいたことは、
ビルド失敗時に必要なパッチを探すのが大変ってこと。

今は下記のように調査・対応してます(大体これでいけるような?)。
openSUSEのOBSの検索(http://software.opensuse.org/search)で
パッケージを検索する。
同一パッケージでも、いろいろなソースが出てくるので、
mingw64のところのソース(rpm)を落としてくる。
rpmの中のcpioの中にソース、パッチとspecファイルが入っているので、
パッチは中身をさらっと確認して、適用。
specファイルを参考にして、configure、make、make install。

それでは、ビルドが続きます。


(1)gimpが使用している他パッケージ(以外もあるけど)

・libopenjpeg

cd $LOCALBUILDDIR
tar xzf openjpeg-1.5.1.tar.gz
cd openjpeg-1.5.1
./configure --build=x86_64-w64-mingw32 --prefix=$LOCALDESTDIR
make
make install

・JasPer

http://software.opensuse.org/download.html?project=windows:mingw:win64&package=mingw64-jasper

mingw64-jasper-1.900.1-6.231.src.rpm

cd $LOCALBUILDDIR
unzip -o jasper-1.900.1.zip
cd jasper-1.900.1

パッチ配置($LOCALBUILDDIR/jasper-1.900.1に配置)

jasper-1.900.1-canonical-target.patch
jasper-1.900.1-enable-shared.patch
jasper-1.900.1-mingw64.patch
jasper-1.900.1-sleep.patch
patch-libjasper-stepsizes-overflow.diff

パッチ適用

patch -p1 < jasper-1.900.1-sleep.patch
patch -p1 < jasper-1.900.1-mingw64.patch
patch -p1 < jasper-1.900.1-enable-shared.patch
patch -p1 < patch-libjasper-stepsizes-overflow.diff
patch -p1 < jasper-1.900.1-canonical-target.patch

libtoolize --copy --force
aclocal
automake --add-missing
autoconf
./configure --build=x86_64-w64-mingw32 --prefix=$LOCALDESTDIR --enable-shared --disable-opengl --enable-libjpeg
make
make install

・lcms

cd $LOCALBUILDDIR
tar xzf lcms-1.19.tar.gz
cd lcms-1.19
./configure --prefix=$LOCALDESTDIR --build=x86_64-w64-mingw32 CPPFLAGS="-I/opt/include -I/c/Python27/include" LIBS="-L/opt/lib -L/c/Python27/Lib"
make
make install

・babl

cd $LOCALBUILDDIR
tar -jxf babl-0.1.10.tar.bz2
cd babl-0.1.10
./configure --prefix=$LOCALDESTDIR --build=x86_64-w64-mingw32 CPPFLAGS="-I/usr/include -I/c/Python27/include" LIBS="-L/usr/lib -L/c/Python27/Lib" --enable-shared --disable-static

C:\MinGW\build64\babl-0.1.10\babl\babl-palette.c
下記を削除する。
#include <values.h>

make
make install

・gegl

cd $LOCALBUILDDIR
tar -jxf gegl-0.2.0.tar.bz2
cd gegl-0.2.0
./configure --prefix=$LOCALDESTDIR --build=x86_64-w64-mingw32 CPPFLAGS="-I/usr/include -I/c/Python27/include -I/local64/include" LIBS="-L/usr/lib -L/c/Python27/Lib" --enable-shared --disable-static --without-sdl --disable-docs
make
make install

・python連携用?ファイル準備

partha先生(http://www.partha.com/articles/buildinggimp.html)を真似。
「pygtk-codegen-2.0」ファイルを
C:\Python27に作成。

「pygtk-codegen-2.0」
----
#! /bin/sh
prefix=c:/Python27
exec_prefix=${prefix}
pygobject_script=${exec_prefix}/pygobject-codegen-2.0
echo "note: pygtk-codegen-2.0 is deprecated, use pygobject-codegen-2.0 instead" > /dev/stderr
echo "note: I will now try to invoke pygobject-codegen-2.0 in the same directory" > /dev/stderr
exec $pygobject_script "$@"
----

「pygobject-codegen-2.0」ファイルを
C:\Python27に作成。

「pygobject-codegen-2.0」
----
#!/bin/sh
prefix=@prefix@
datarootdir=@datarootdir@
datadir=c:/Python27
codegendir=${datadir}/site-packages/gtk-2.0/codegen
PYTHONPATH=$codegendir
export PYTHONPATH
exec c:/Python27/python.exe c:/Python27/Lib/site-packages/gtk-2.0/codegen/codegen.py "$@"
----

・pygtkのdef

下記フォルダを作成
C:\Python27\share\pygtk\2.0\defs

pygtk-2.24.0.tar.bz2を展開して、
pygtk-2.24.0\gtk\gtk-base-types.defs
↓リネームしてコピー
C:\Python27\share\pygtk\2.0\defs\gtk-types.defs

pygtk-2.24.0\gtk\gdk-base-types.defs
↓リネームしてコピー
C:\Python27\share\pygtk\2.0\defs\gdk-types.defs

・python27.a作成

msysから、
mingw-get install mingw32-pexports
を実行。

C:\Windows\system32\python27.dll

C:\Python27
へコピー。

pexports /c/python27/python27.dll > /c/python27/python27.def

/mingw64/bin/dlltool -v --dllname /c/python27/python27.dll --def /c/python27/python27.def --output-lib /c/python27/libs/libpython27.a

python周りいろいろやったけど、
結局プラグイン認識できてない・・・。
次回以降解決したい。

・libxslt

cd $LOCALBUILDDIR
tar xzf libxslt-1.1.28.tar.gz
cd libxslt-1.1.28
./configure --prefix=$LOCALDESTDIR --build=x86_64-w64-mingw32 CPPFLAGS="-I/usr/include -I/c/Python27/include" LIBS="-L/usr/lib -L/c/Python27/Lib"

windows向けに下記を修正

C:\MinGW\build64\libxslt-1.1.28\libxslt\security.c
line:346
- ret = mkdir(directory, 0755);
+ ret = mkdir(directory);

make
make install

・iso-codes

cd $LOCALBUILDDIR
tar xf iso-codes-3.41.tar.xz
cd iso-codes-3.41
./configure --build=x86_64-w64-mingw32 --prefix=$LOCALDESTDIR
make
make install

・libexif

cd $LOCALBUILDDIR
tar xzf libexif-0.6.20.tar.gz
cd libexif-0.6.20
./configure --build=x86_64-w64-mingw32 --prefix=$LOCALDESTDIR
make
make install

・bz2

http://software.opensuse.org/download.html?project=windows:mingw:win64&package=mingw64-bzip2

mingw64-bzip2-1.0.6-3.218.src.rpm

cd $LOCALBUILDDIR
tar xzf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6

bzip2-1.0.4-bzip2recover.patch
bzip2-1.0.5-slash.patch
bzip2-1.0.6-dll.patch

patch -p1 < bzip2-1.0.4-bzip2recover.patch
patch -p1 < bzip2-1.0.5-slash.patch
patch -p1 < bzip2-1.0.6-dll.patch

make -f Makefile-libbz2_so
make clean
make

C:\MinGW\build64\bzip2-1.0.6\Makefile
の下記を修正(「.exe」を追記)
(参考:http://mingw.doorblog.jp/archives/22758238.html

chmod a+x $(PREFIX)/bin/bzip2.exe
chmod a+x $(PREFIX)/bin/bunzip2.exe
chmod a+x $(PREFIX)/bin/bzcat.exe
chmod a+x $(PREFIX)/bin/bzip2recover.exe

make install PREFIX=$LOCALDESTDIR

cp ./bz2-1.dll $LOCALDESTDIR/bin
cp ./libbz2.dll.a $LOCALDESTDIR/lib

・libcroco

cd $LOCALBUILDDIR
tar xf libcroco-0.6.8.tar.xz
cd libcroco-0.6.8
./configure --prefix=$LOCALDESTDIR --build=x86_64-w64-mingw32
make
make install

・librsvg

http://software.opensuse.org/download.html?project=windows:mingw:win64&package=mingw64-librsvg

mingw64-librsvg-2.36.3-2.75.src.rpm

cd $LOCALBUILDDIR
tar xf librsvg-2.36.4.tar.xz
cd librsvg-2.36.4

※ここではlibrsvg-2.36.4.tar.xzを使用するが、patchはそのまま使える
librsvg-2.32.0-gtk3.patch

patch -p1 < librsvg-2.32.0-gtk3.patch

./configure --prefix=$LOCALDESTDIR --build=x86_64-w64-mingw32 --disable-introspection --enable-gtk-theme --disable-pixbuf-loader --enable-shared --disable-static

make
make install


(2)gimp

いよいよgimpです。

・gimp-2.8.4

まずはtarボールを使ってやってみます。

cd $LOCALBUILDDIR
tar -jxf gimp-2.8.4.tar.bz2
cd gimp-2.8.4
export PYTHON_LIBS="-L/c/Python27/libs -lpython27"

./configure --prefix=/c/work/gimpbin/gimp-2.8.4 --build=x86_64-w64-mingw32 CPPFLAGS="-I/usr/include -I/c/Python27/include -I/local64/include" LIBS="-L/usr/lib -L/c/Python27/Lib" CFLAGS="-DMS_WIN64" --enable-debug --without-gvfs

※1の修正を行う。

make
make install

起動用batを作成して、batから実行。

gimp-2.8.4_start.bat
---
rem gtk+-2.24.16では、LANG設定する必要なし
rem set LANG=de
set HOME=C:\work\gimphome\gimp-2.8.4
if not exist %HOME% mkdir %HOME% > nul
set PATH=C:\work\gimpbin\gimp-2.8.4;C:\work\gimpbin\gimp-2.8.4\bin;C:\MinGW\local64;C:\MinGW\local64\bin;C:\MinGW\mingw64\bin;%PATH%
start C:\work\gimpbin\gimp-2.8.4\bin\gimp-2.8.exe
---


次はgitのソースでやってみます。
まずは2.8系。

c:/work/git/gimpに
git clone
git://git.gnome.org/gimp

・git-gimp-2.8

2.8系も次の2.8.6?リリースに向けて修正が日々入るので、
windowsでビルドができないコミットが入ることがあります。

解決したい場合は、
gimp-2.8系に関するbug検索
http://www.google.com/custom?hl=ja&domains=mail.gnome.org&hq=inurl%3A%2Farchives%2F&q=gimp%2Fgimp-2-8+Bug
で探すと出てくることがあります。
gimp最新系(2.9)からのフィードバックもあるので、
gimp全般
http://www.google.com/custom?hl=ja&domains=mail.gnome.org&hq=inurl%3A%2Farchives%2F&q=gimp+Bug&as_qdr=y
から検索してもよいかも。


openSUSEの時と同様に、
c:/work/git/gimp

c:/work/git/gimp-2.8
にまるごとコピーして、
2.8系用のブランチにスイッチする。


cd /c/work/git/gimp-2.8
export PYTHON_INCLUDES="-I/c/Python27/include/"
export PYTHON_LIBS="-L/c/Python27/libs -lpython27"
export PYTHON_LIB_LOC="/c/Python27/libs/"
export ACLOCAL_FLAGS="-I/local64/share/aclocal -I/c/MinGW/opt/share/aclocal"

./autogen.sh --prefix=/c/work/gimpbin/git-gimp-2.8 --build=x86_64-w64-mingw32 CPPFLAGS="-I/usr/include -I/c/Python27/include -I/local64/include" LIBS="-L/usr/lib -L/c/Python27/Lib" CFLAGS="-DMS_WIN64" --enable-debug --without-gvfs --disable-gtk-doc


※1の修正

※2の修正
 Bug 593167 - Support Windows in gimp_get_default_unit()
 2013/3/18のコミットでwindowsエラーがでるようになった。

※3の修正
 たぶんmsysからgitコマンドが使えない場合にエラーとなるので、

 app/git-version.hを手動で作成。
 tarボールでとってきたソースにはもともと入っているので問題ない。

make
make install

起動用batを作成して、batから実行。

git-gimp-2.8_start.bat
---
rem gtk+-2.24.16では、LANG設定する必要なし
rem set LANG=de
set HOME=C:\work\gimphome\git-gimp-2.8
if not exist %HOME% mkdir %HOME% > nul
set PATH=C:\work\gimpbin\git-gimp-2.8;C:\work\gimpbin\git-gimp-2.8\bin;C:\MinGW\local64;C:\MinGW\local64\bin;C:\MinGW\mingw64\bin;%PATH%
start C:\work\gimpbin\git-gimp-2.8\bin\gimp-2.8.exe
---

・git-gimp-painter-2.7_postprocess

openSUSEの時と同様に、
c:/work/git/gimp-painter-2.7

c:/work/git/gimp-painter-2.7_postprocess
にまるごとコピーして、
postprocess用のブランチにスイッチする。

cd /c/work/git/gimp-painter-2.7_postprocess
export PYTHON_INCLUDES="-I/c/Python27/include/"
export PYTHON_LIBS="-L/c/Python27/libs -lpython27"
export PYTHON_LIB_LOC="/c/Python27/libs/"
export ACLOCAL_FLAGS="-I/local64/share/aclocal -I/c/MinGW/opt/share/aclocal"

./autogen.sh --prefix=/c/work/gimpbin/git-gimp-painter-2.7_postprocess --build=x86_64-w64-mingw32 CPPFLAGS="-I/usr/include -I/c/Python27/include -I/local64/include" LIBS="-L/usr/lib -L/c/Python27/Lib" CFLAGS="-DMS_WIN64" --enable-debug --without-gvfs --disable-gtk-doc

※3の修正

※4の修正

make
make install

起動用batを作成して、batから実行。

git-gimp-painter-2.7_postprocess_start.bat
---
rem gtk+-2.24.16では、LANG設定する必要なし
rem set LANG=de
set HOME=C:\work\gimphome\git-gimp-painter-2.7_postprocess
if not exist %HOME% mkdir %HOME% > nul
set PATH=C:\work\gimpbin\git-gimp-painter-2.7_postprocess;C:\work\gimpbin\git-gimp-painter-2.7_postprocess\bin;C:\MinGW\local64;C:\MinGW\local64\bin;C:\MinGW\mingw64\bin;%PATH%
start C:\work\gimpbin\git-gimp-painter-2.7_postprocess\bin\gimp-2.8.exe
---

やっとwindowsで起動できた。。。
rotate、mypaintブラシが動くのと、
処理がpostprocess(ペン操作後少し遅れて効果が表示?)されるようです。



・git-gimp-2.9

次は、gitの最新コードでビルドと思ったけど、
windowsではうまくビルドができなかったのでとりあえずしばらく放置。


eclipseでのdebugは次回。


=============

(※1)windows向けビルドでいつも修正が必要な箇所。

gimp起動時に、Gimp-Text-ERROR pangoほにゃららダイアログが出る。

修正内容

app\text\gimpfontlist.c

fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
if (! fontmap)
g_error ("You are using a Pango that has been built against a cairo "
"that lacks the Freetype font backend");



fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
if (! fontmap)
fontmap = pango_cairo_font_map_get_default ();
if (! fontmap)
g_error ("You are using a Pango that has been built against a cairo "
"that lacks the Freetype font backend");


下記も同様に更新しておく。
app/text/gimptext-compat.c
app/text/gimptextlayout.c


(※2)make時、下記エラーになる場合。

make[4]: Entering directory `/c/work/git/gimp-2.8/app/core'
  CC     gimp-utils.o
gimp-utils.c: In function 'gimp_get_default_language':
gimp-utils.c:299:10: warning: unused variable 'cat' [-Wunused-variable]
gimp-utils.c: In function 'gimp_get_default_unit':
gimp-utils.c:363:3: error: unknown type name 'DWORD'
gimp-utils.c:366:3: warning: implicit declaration of function 'GetLocaleInfo' [-
Wimplicit-function-declaration]
gimp-utils.c:366:23: error: 'LOCALE_USER_DEFAULT' undeclared (first use in this
function)
gimp-utils.c:366:23: note: each undeclared identifier is reported only once for
each function it appears in
gimp-utils.c:367:23: error: 'LOCALE_IMEASURE' undeclared (first use in this func
tion)
gimp-utils.c:367:41: error: 'LOCALE_RETURN_NUMBER' undeclared (first use in this
 function)
gimp-utils.c:368:24: error: 'LPTSTR' undeclared (first use in this function)
gimp-utils.c:369:52: error: 'TCHAR' undeclared (first use in this function)
gimp-utils.c: In function 'gimp_value_array_truncate':
gimp-utils.c:490:5: warning: 'g_value_array_remove' is deprecated (declared at C
:/MinGW/local64/include/glib-2.0/gobject/gvaluearray.h:91): Use 'g_array_remove_
index' instead [-Wdeprecated-declarations]
make[4]: *** [gimp-utils.o] Error 1
make[4]: Leaving directory `/c/work/git/gimp-2.8/app/core'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/c/work/git/gimp-2.8/app'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/c/work/git/gimp-2.8/app'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/c/work/git/gimp-2.8'
make: *** [all] Error 2

修正内容

app/core/gimp-utils.c

Bug593167.patch
を作成して、コミットされた修正をreverseして戻す。

下記サイトから全てコピーして、Bug593167.patchを作成して、
C:\work\git\gimp-2.8に配置。

https://mail.gnome.org/archives/commits-list/2013-March/msg21051.html

commit 194ef70d7446a627c274135c54498d3092c9b356
から
return GIMP_UNIT_MM;
までコピー。

パッチ適用を戻す。
cd /c/work/git/gimp-2.8
patch -p1 -R < Bug593167.patch

(※3)make時、下記エラーになる場合。

about-dialog.c:36:25: fatal error: git-version.h: No such file or directory

make cleanで消えるので注意。

追加内容

何かそれっぽいのをてきとーに。。

app/git-version.h
---
#ifndef __GIT_VERSION_H__
#define __GIT_VERSION_H__
#define GIMP_GIT_VERSION "GIMP_2_8"
#define GIMP_GIT_LAST_COMMIT_YEAR "2013"
#endif /* __GIT_VERSION_H__ */
---

(※4)gimp-painter-2.7向けdiff

gimp-painter-2.7_postprocess.diff
https://sites.google.com/site/gimpbuilder/files/gimp-painter-2.7_postprocess.diff?attredirects=0&d=1

windowsでせめて起動できるように
なんとか自力でgtkのエラーがでないようにしただけ。。。
ちょっと画面を動かすとエラーがでまくります><

0 件のコメント:

コメントを投稿