From 973fcc0553a331b1fdbfa5620a9192b4be57dbd4 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Sat, 22 Jan 2022 22:32:52 +1000 Subject: [PATCH] AzPainter: add recipe --- .../additional-files/azpainter.rdef.in | 31 +++ media-gfx/azpainter/azpainter-3.0.4.recipe | 103 ++++++++++ .../patches/azpainter-3.0.4.patchset | 178 ++++++++++++++++++ .../azpainter/patches/disable_cursors.patch | 33 ++++ 4 files changed, 345 insertions(+) create mode 100644 media-gfx/azpainter/additional-files/azpainter.rdef.in create mode 100644 media-gfx/azpainter/azpainter-3.0.4.recipe create mode 100644 media-gfx/azpainter/patches/azpainter-3.0.4.patchset create mode 100644 media-gfx/azpainter/patches/disable_cursors.patch diff --git a/media-gfx/azpainter/additional-files/azpainter.rdef.in b/media-gfx/azpainter/additional-files/azpainter.rdef.in new file mode 100644 index 000000000..87ff6dc17 --- /dev/null +++ b/media-gfx/azpainter/additional-files/azpainter.rdef.in @@ -0,0 +1,31 @@ + +resource app_flags B_MULTIPLE_LAUNCH; + +resource app_version { + major = @MAJOR@, + middle = @MIDDLE@, + minor = @MINOR@, + variety = B_APPV_FINAL, + internal = 0, + short_info = "AzPainter", + long_info = "@LONG_INFO@" +}; + +resource app_signature "@APP_SIGNATURE@"; + +resource vector_icon { + $"6E6369660A03C46805020006023B5F8C3892CABB1F6A3E0BF0492A4E47706700" + $"FFF9CEFFFFEBC0020006023B3049396B0ABA90833C646E4A101543299500FFFF" + $"FFFFFFF28902000602B7465D385FF3BBBFC4BA95C24A5F424B291400E07900FF" + $"FFF28902000602395E1E32DB49B6921A3D07D74A57904908D600ED9406FFFCB2" + $"3D040174020002023DA0000000000000003E8FFF48A00048000000E9F6FD77FF" + $"00A7FFE5050102000602B702A3B6A28C38F6C0B962D54A49284945BE00B09904" + $"FFFDFF6E0200060238BAC4B98B6F3A933439F73B4840674A8E910000AAFFFFFF" + $"FFFF080A04475F585F5F53534E0A06252B2549465B5054502F30250A04262B26" + $"49465A46370A04262B45374F3030260A044637465A4F544F300608EEEB3F5642" + $"40464DBF54BBCB282F3238323532382F38B9DEBCC2B813BC5C2837323E2A3EB6" + $"C4BEE03E450605AE032A45364D2F4EBE86C4893D47394435463845BA11C29208" + $"02403F50280A0A050100000A0701011001178322040A010102000A020103000A" + $"040104000A060105000A0701061001178400040A090106000A07010710011789" + $"12040A080107100117850004" +}; diff --git a/media-gfx/azpainter/azpainter-3.0.4.recipe b/media-gfx/azpainter/azpainter-3.0.4.recipe new file mode 100644 index 000000000..1a50461d3 --- /dev/null +++ b/media-gfx/azpainter/azpainter-3.0.4.recipe @@ -0,0 +1,103 @@ +SUMMARY="Paint software for editing illustrations and images" +DESCRIPTION="AzPainter is a full color painting software for Linux. + +It’s a lightweight tool with tablet pressure support, and provides basic \ +functions such as selection, layers, filters. + +The software uses an original graphic toollkit called Mlib. It’s extremely lightweight. + +Features include: +* Extremely fast and frugal on system resources. +* Optimized user interface designed for efficient painting and drawing workflow. +* Support for 16-bit color images with transparency (RGBA) +* Automatic brush size adjustment that’s dependent on tablet pen pressure. +* Many artistic filters. +* Good range of selection tools. +* Support for many third-party image formats including PSD, PNG, JPG and more." +HOMEPAGE="http://azsky2.html.xdomain.jp/" +COPYRIGHT="2013-2022 Azel" +LICENSE="GNU GPL v3" +REVISION="1" +SOURCE_URI="https://gitlab.com/azelpg/azpainter/-/archive/v$portVersion/azpainter-v$portVersion.tar.gz" +CHECKSUM_SHA256="98037b35642ed4f3e6c622951868ed13c242ba8a30755b4da823a0be77df7f55" +SOURCE_DIR="azpainter-v$portVersion" +PATCHES=" + azpainter-$portVersion.patchset + disable_cursors.patch + " +ADDITIONAL_FILES="azpainter.rdef.in" + +ARCHITECTURES="all !x86_gcc2" +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + azpainter$secondaryArchSuffix = $portVersion + app:AzPainter = $portVersion + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libfontconfig$secondaryArchSuffix + lib:libfreetype$secondaryArchSuffix + lib:libiconv$secondaryArchSuffix + lib:libjpeg$secondaryArchSuffix + lib:libpng16$secondaryArchSuffix + lib:libtiff$secondaryArchSuffix + lib:libwebp$secondaryArchSuffix + lib:libX11$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libfontconfig$secondaryArchSuffix + devel:libfreetype$secondaryArchSuffix + devel:libiconv$secondaryArchSuffix + devel:libjpeg$secondaryArchSuffix + devel:libpng16$secondaryArchSuffix + devel:libtiff$secondaryArchSuffix + devel:libwebp$secondaryArchSuffix + devel:libX11$secondaryArchSuffix + devel:libz$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:gcc$secondaryArchSuffix + cmd:make + cmd:pkg_config$secondaryArchSuffix + cmd:which + " + +BUILD() +{ + ./configure --prefix=$prefix \ + --bindir=$appsDir \ + --datarootdir=$dataDir \ + --datadir=$dataDir \ + --docdir=$docDir + + make $jobArgs +} + +INSTALL() +{ + make install + + mv $appsDir/azpainter $appsDir/AzPainter + rm -rf $dataDir/{mime,icons,applications} + + local APP_SIGNATURE="application/x-vnd.azpainter" + local MAJOR="`echo "$portVersion" | cut -d. -f1`" + local MIDDLE="`echo "$portVersion" | cut -d. -f2`" + local MINOR="`echo "$portVersion" | cut -d. -f3`" + local LONG_INFO="$SUMMARY" + sed \ + -e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \ + -e "s|@MAJOR@|$MAJOR|" \ + -e "s|@MIDDLE@|$MIDDLE|" \ + -e "s|@MINOR@|$MINOR|" \ + -e "s|@LONG_INFO@|$LONG_INFO|" \ + $portDir/additional-files/azpainter.rdef.in > azpainter.rdef + + addResourcesToBinaries azpainter.rdef $appsDir/AzPainter + + addAppDeskbarSymlink $appsDir/AzPainter +} diff --git a/media-gfx/azpainter/patches/azpainter-3.0.4.patchset b/media-gfx/azpainter/patches/azpainter-3.0.4.patchset new file mode 100644 index 000000000..da7b1a4f4 --- /dev/null +++ b/media-gfx/azpainter/patches/azpainter-3.0.4.patchset @@ -0,0 +1,178 @@ +From 79ac419261c143e0639214f5385bd0805db741e5 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Sat, 22 Jan 2022 22:03:32 +1000 +Subject: Fix for Haiku + + +diff --git a/Makefile.in b/Makefile.in +index f81ef33..3c5bcde 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -15,8 +15,8 @@ inst_dir := install -m 755 -d + inst_file := install -m 644 + + CC := @CC@ +-CFLAGS := @CFLAGS@ -pthread -Isrc/include -Imlk/include -I. -DHAVE_CONFIG_H +-LDFLAGS := @LDFLAGS@ -pthread ++CFLAGS := @CFLAGS@ -Isrc/include -Imlk/include -I. -DHAVE_CONFIG_H ++LDFLAGS := @LDFLAGS@ + LIBS := @LIBS@ -lm + + TARGET := azpainter +diff --git a/config.h.in b/config.h.in +index cc5b0f3..da25117 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -2,7 +2,7 @@ + #undef MLK_NO_FREETYPE_VARIABLE + + #define MLK_NO_ICONTHEME +-#define MLK_X11_HAVE_XINPUT2 ++#define MLK_X11_NO_XSHM + + #undef HAVE_MMX + #undef HAVE_SSE +diff --git a/configure b/configure +index ab88aeb..e0d73fb 100755 +--- a/configure ++++ b/configure +@@ -355,8 +355,6 @@ fc_check_lib libtiff "libtiff-4" "" "-ltiff" "tiff.h" "" "libtiff-dev or libtiff + fc_check_lib libwebp "libwebp" "" "-lwebp" "webp/decode.h" "" "libwebp-dev or libwebp-devel or libwebp or webp" + fc_check_lib x11 "x11" "" "-lX11" "X11/Xlib.h" "" "libx11-dev or libX11-devel or libx11" + fc_check_lib xext "xext" "" "-lXext" "X11/Xlib.h X11/extensions/XShm.h" "" "libxext-dev or libXext-devel or libxext" +-fc_check_lib xcursor "xcursor" "" "-lXcursor" "X11/Xlib.h X11/Xcursor/Xcursor.h" "" "libxcursor-dev or libXcursor-devel or libxcursor" +-fc_check_lib xinput "xi" "" "-lXi" "X11/Xlib.h X11/extensions/XInput2.h" "" "libxi-dev or libXi-devel or libxi" + fc_check_lib fontconfig "fontconfig" "" "-lfontconfig -lfreetype" "fontconfig/fontconfig.h" "/usr/include/freetype2 /usr/local/include/freetype2 /opt/X11/include/freetype2" "libfontconfig1-dev or libfontconfig-devel or fontconfig" + fc_check_lib freetype2 "freetype2" "" "" "ft2build.h" "" "libfreetype6-dev or libfreetype6-devel or freetype2" + +diff --git a/mlk/include/mlk_platform.h b/mlk/include/mlk_platform.h +index 39550d0..0a8748b 100644 +--- a/mlk/include/mlk_platform.h ++++ b/mlk/include/mlk_platform.h +@@ -24,6 +24,8 @@ $*/ + #define MLK_PLATFORM_FREEBSD + #elif defined(__APPLE__) && defined(__MACH__) + #define MLK_PLATFORM_MACOS ++#elif defined(__HAIKU__) ++ #define MLK_PLATFORM_HAIKU + #else + #define MLK_PLATFORM_LINUX + #endif +diff --git a/mlk/src/gui/x11/mlk_x11.h b/mlk/src/gui/x11/mlk_x11.h +index 361ba15..490a844 100644 +--- a/mlk/src/gui/x11/mlk_x11.h ++++ b/mlk/src/gui/x11/mlk_x11.h +@@ -46,9 +46,11 @@ $*/ + #include + #endif + ++#ifndef __HAIKU__ + #ifdef MLKX11_INC_XCURSOR + #include + #endif ++#endif + + #if defined(MLKX11_INC_XSHM) && !defined(MLK_X11_NO_XSHM) + #include +diff --git a/mlk/src/gui/x11/mlk_x11_cursor.c b/mlk/src/gui/x11/mlk_x11_cursor.c +index a55f816..27e3308 100644 +--- a/mlk/src/gui/x11/mlk_x11_cursor.c ++++ b/mlk/src/gui/x11/mlk_x11_cursor.c +@@ -41,7 +41,9 @@ void __mX11CursorFree(mCursor cur) + + mCursor __mX11CursorLoad(const char *name) + { ++#ifndef __HAIKU__ + return XcursorLibraryLoadCursor(MLKX11_DISPLAY, name); ++#endif + } + + /** 1bit データからカーソル作成 */ +@@ -92,6 +94,7 @@ mCursor __mX11CursorCreate1bit(const uint8_t *buf) + + mCursor __mX11CursorCreateRGBA(int width,int height,int hotspot_x,int hotspot_y,const uint8_t *buf) + { ++#ifndef __HAIKU__ + XcursorImage *img; + XcursorPixel *pd; + int ix,iy; +@@ -124,5 +127,8 @@ mCursor __mX11CursorCreateRGBA(int width,int height,int hotspot_x,int hotspot_y, + XcursorImageDestroy(img); + + return cur; ++#else ++ return 0; ++#endif + } + +diff --git a/mlk/src/mlk_file.c b/mlk/src/mlk_file.c +index dacc7b8..8a87d9b 100644 +--- a/mlk/src/mlk_file.c ++++ b/mlk/src/mlk_file.c +@@ -386,6 +386,9 @@ mlkerr mCreateDir(const char *path,int perm) + str = mUTF8toLocale(path, -1, NULL); + if(!str) return MLKERR_ALLOC; + ++ if (mIsExistDir(path)) ++ return MLKERR_EXIST; ++ + ret = mkdir(str, perm); + + mFree(str); +diff --git a/mlk/src/mlk_util_sys.c b/mlk/src/mlk_util_sys.c +index a8e5385..fd9496d 100644 +--- a/mlk/src/mlk_util_sys.c ++++ b/mlk/src/mlk_util_sys.c +@@ -39,6 +39,10 @@ $*/ + #include + #include + ++#elif defined(MLK_PLATFORM_HAIKU) ++/* Haiku */ ++#include ++ + #endif + + //----------- +@@ -143,6 +147,19 @@ char *mGetSelfExePath(void) + if(sysctl(mib, 4, buf, &len, NULL, 0) != 0) + len = 0; + ++#elif defined(MLK_PLATFORM_HAIKU) ++ /* Haiku */ ++ size_t len = 0; ++ image_info info; ++ int32 cookie = 0; ++ while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { ++ if (info.type == B_APP_IMAGE) { ++ strcpy(buf, info.name); ++ len = strlen(info.name); ++ break; ++ } ++ } ++ + #else + /* Linux */ + +diff --git a/src/main.c b/src/main.c +index 04f6924..d169be5 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -382,9 +382,13 @@ static int _init_main(int argc,char **argv) + + //パスセット + ++#ifdef __HAIKU__ ++ mGuiSetPath_data_exe("../data/azpainter3"); ++ mGuiSetPath_config_home("config/settings/azpainter"); ++#else + mGuiSetPath_data_exe("../share/azpainter3"); + mGuiSetPath_config_home(".config/azpainter"); +- ++#endif + //翻訳データ + + mGuiLoadTranslation(g_deftransdat, NULL, "tr"); +-- +2.30.2 + diff --git a/media-gfx/azpainter/patches/disable_cursors.patch b/media-gfx/azpainter/patches/disable_cursors.patch new file mode 100644 index 000000000..b1ce5ef1a --- /dev/null +++ b/media-gfx/azpainter/patches/disable_cursors.patch @@ -0,0 +1,33 @@ +diff --git a/mlk/src/gui/x11/mlk_x11_cursor.c b/mlk/src/gui/x11/mlk_x11_cursor.c +index 27e3308..c2c8d5d 100644 +--- a/mlk/src/gui/x11/mlk_x11_cursor.c ++++ b/mlk/src/gui/x11/mlk_x11_cursor.c +@@ -31,8 +31,10 @@ $*/ + + void __mX11CursorFree(mCursor cur) + { ++#ifndef __HAIKU__ + if(cur) + XFreeCursor(MLKX11_DISPLAY, (Cursor)cur); ++#endif + } + + /** デフォルトテーマから指定名のカーソル読み込み +@@ -50,6 +52,7 @@ mCursor __mX11CursorLoad(const char *name) + + mCursor __mX11CursorCreate1bit(const uint8_t *buf) + { ++#ifndef __HAIKU__ + Display *disp = MLKX11_DISPLAY; + int w,h; + Pixmap img,mask; +@@ -88,6 +91,9 @@ mCursor __mX11CursorCreate1bit(const uint8_t *buf) + if(mask) XFreePixmap(disp, mask); + + return cur; ++#else ++ return 0; ++#endif + } + + /** RGBA イメージからカーソル作成 */