Hello,

Attached is a version which uses PREFIX for both Makefile (that one
I overlooked) and setup.c. For setup.c it would still be nice to
figure it out at runtime. I didn't have any time for that yet due to
health problems.

Kind regards,

Axel Scheepers


diff -ruN /usr/ports.orig/graphics/grafx2/Makefile 
/usr/ports/graphics/grafx2/Makefile
--- /usr/ports.orig/graphics/grafx2/Makefile    Thu Jan  1 01:00:00 1970
+++ /usr/ports/graphics/grafx2/Makefile Fri Nov 18 14:27:13 2011
@@ -0,0 +1,34 @@
+# $OpenBSD$
+
+COMMENT=       a pixelart oriented painting program
+
+V=             2.3.1781
+DISTNAME=      grafx2-${V}-src
+CATEGORIES=    graphics 
+
+PKGNAME=       grafx2-${V}
+
+EXTRACT_SUFX=  .tgz
+
+HOMEPAGE=      http://code.google.com/p/grafx2/
+
+# GPLv2
+PERMIT_PACKAGE_CDROM=  Yes
+PERMIT_PACKAGE_FTP=    Yes
+PERMIT_DISTFILES_CDROM= Yes
+PERMIT_DISTFILES_FTP=  Yes
+
+MASTER_SITES=  http://grafx2.googlecode.com/files/
+
+WANTLIB += SDL_image SDL_ttf png lua X11
+
+USE_GMAKE=     Yes
+
+LIB_DEPENDS=   devel/sdl devel/sdl-image devel/sdl-ttf graphics/png lang/lua
+
+#MAKE_FLAGS=   NOLUA=1
+CFLAGS+=       -DPORTS_PREFIX=\"${PREFIX}\"
+WRKSRC=                ${WRKDIR}/grafx2/src
+WRKDIST=       ${WRKSRC}
+
+.include <bsd.port.mk>
diff -ruN /usr/ports.orig/graphics/grafx2/distinfo 
/usr/ports/graphics/grafx2/distinfo
--- /usr/ports.orig/graphics/grafx2/distinfo    Thu Jan  1 01:00:00 1970
+++ /usr/ports/graphics/grafx2/distinfo Tue Nov  8 21:48:00 2011
@@ -0,0 +1,4 @@
+MD5 (grafx2-2.3.1781-src.tgz) = 916a35c4762e85b4210a1041fbbfd830
+SHA1 (grafx2-2.3.1781-src.tgz) = 45b95bc99279a0a1fa7667234932d23a4ce8772c
+SHA256 (grafx2-2.3.1781-src.tgz) = 
b43fa837e30abfb0830f9a1b793a78ed690fbafdcd378e51197f01998bbf392e
+SIZE (grafx2-2.3.1781-src.tgz) = 683951
diff -ruN /usr/ports.orig/graphics/grafx2/patches/patch-openbsd-support 
/usr/ports/graphics/grafx2/patches/patch-openbsd-support
--- /usr/ports.orig/graphics/grafx2/patches/patch-openbsd-support       Thu Jan 
 1 01:00:00 1970
+++ /usr/ports/graphics/grafx2/patches/patch-openbsd-support    Fri Nov 18 
19:10:20 2011
@@ -0,0 +1,66 @@
+diff -ru Makefile.org Makefile
+--- Makefile.org       Tue Apr  5 00:41:50 2011
++++ Makefile   Tue Nov  8 18:24:28 2011
+@@ -278,7 +278,7 @@
+ 
+         # Compiles a regular linux executable for the native platform
+         BIN = ../bin/grafx2
+-        COPT = -W -Wall -Wdeclaration-after-statement -std=c99 -c -g 
`sdl-config --cflags` $(TTFCOPT) $(LUACOPT) $(JOYCOPT) $(VKEYCOPT) -O$(OPTIM)
++        COPT = -W -Wall -Wdeclaration-after-statement -std=c99 -c -g 
`sdl-config --cflags` $(TTFCOPT) $(LUACOPT) $(JOYCOPT) $(VKEYCOPT) -O$(OPTIM) 
-I${PREFIX}/include/libpng
+         LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng $(LUALOPT) -lm
+         # Use gcc for compiling. Use ncc to build a callgraph and analyze the 
code.
+         CC = gcc
+diff -ru misc.c.org misc.c
+--- misc.c.org Sun Feb  6 18:16:48 2011
++++ misc.c     Tue Nov  8 18:04:53 2011
+@@ -735,7 +735,10 @@
+ #if defined(__WIN32__)
+ #define _WIN32_WINNT 0x0500
+ #include <windows.h>
+-#elif defined(__macosx__) || defined(__FreeBSD__) || defined(__NetBSD__)
++#elif defined(__macosx__) || defined(__FreeBSD__) || defined(__NetBSD__) || 
defined(__OpenBSD__)
++  #if defined(__OpenBSD__)
++  #include <sys/param.h>
++  #endif
+   #include <sys/sysctl.h>
+ #elif defined(__BEOS__) || defined(__HAIKU__)
+   // sysinfo not implemented
+@@ -777,7 +780,7 @@
+   mstt.dwLength = sizeof(MEMORYSTATUS);
+   GlobalMemoryStatus(&mstt);
+   return mstt.dwAvailPhys;
+-#elif defined(__macosx__) || defined(__FreeBSD__) || defined(__NetBSD__)
++#elif defined(__macosx__) || defined(__FreeBSD__) || defined(__NetBSD__) || 
defined(__OpenBSD__)
+   int mib[2];
+   int maxmem;
+   size_t len;
+diff -ru mountlist.c.org mountlist.c
+--- mountlist.c.org    Fri Mar 11 18:39:54 2011
++++ mountlist.c        Tue Nov  8 18:17:50 2011
+@@ -23,11 +23,16 @@
+ 
#if(!defined(__WIN32__))&&(!defined(__amigaos4__))&&(!defined(__AROS__))&&(!defined(__MORPHOS__))&&(!defined(__amigaos__))
+ 
+ // We don't use autoconf and all that in grafx2, so let's do the config here 
...
+-#if defined(__macosx__) || defined(__FreeBSD__)                        // 
MacOS X is POSIX compliant
++#if defined(__macosx__) || defined(__FreeBSD__) || defined(__OpenBSD__)       
                // MacOS X is POSIX compliant
+     #define MOUNTED_GETMNTINFO
+ #if defined(__macosx__)
+     #include <sys/types.h>
+ #endif
++#if defined(__OpenBSD__)
++    #define HAVE_STRUCT_STATFS_F_FSTYPENAME 1
++    #include <sys/param.h> /* types.h needs this */
++    #include <sys/types.h>
++#endif
+ #elif defined(__NetBSD__)
+     #define MOUNTED_GETMNTINFO2
+ #elif defined(__BEOS__) || defined(__HAIKU__)
+@@ -463,7 +468,7 @@
+         me = malloc (sizeof *me);
+         me->me_devname = strdup (fsp->f_mntfromname);
+         me->me_mountdir = strdup (fsp->f_mntonname);
+-#if defined(__macosx__)
++#if defined(__macosx__) || defined(__OpenBSD__)
+         me->me_type = fsp->f_fstypename;
+ #else
+         me->me_type = fsp->fs_typename;
diff -ruN /usr/ports.orig/graphics/grafx2/patches/patch-path 
/usr/ports/graphics/grafx2/patches/patch-path
--- /usr/ports.orig/graphics/grafx2/patches/patch-path  Thu Jan  1 01:00:00 1970
+++ /usr/ports/graphics/grafx2/patches/patch-path       Fri Nov 18 20:12:20 2011
@@ -0,0 +1,12 @@
+--- setup.c.orig       Sun Feb  6 17:58:14 2011
++++ setup.c    Fri Nov 18 14:05:32 2011
+@@ -109,6 +109,9 @@
+   }  
+   Extract_path(program_dir, argv0);
+   
++  #elif defined(__OpenBSD__)
++    strncpy(program_dir, PORTS_PREFIX"/bin/", MAX_PATH_CHARACTERS);
++
+   // Others: The part of argv[0] before the executable name.    
+   // Keep the last \ or /.
+   // On Windows, Mingw32 already provides the full path in all cases.
diff -ruN /usr/ports.orig/graphics/grafx2/pkg/DESCR 
/usr/ports/graphics/grafx2/pkg/DESCR
--- /usr/ports.orig/graphics/grafx2/pkg/DESCR   Thu Jan  1 01:00:00 1970
+++ /usr/ports/graphics/grafx2/pkg/DESCR        Tue Nov  8 21:49:14 2011
@@ -0,0 +1,7 @@
+GrafX2 is a bitmap paint program inspired by the Amiga programs 
+Deluxe Paint and Brilliance. Specialized in 256-color drawing, it includes a
+very large number of tools and effects that make it particularly suitable for
+pixel art, game graphics, and generally any detailed graphics painted with a
+mouse. The program is mostly developed on Linux and Windows, but is also
+portable on many other platforms.
+
diff -ruN /usr/ports.orig/graphics/grafx2/pkg/PLIST 
/usr/ports/graphics/grafx2/pkg/PLIST
--- /usr/ports.orig/graphics/grafx2/pkg/PLIST   Thu Jan  1 01:00:00 1970
+++ /usr/ports/graphics/grafx2/pkg/PLIST        Tue Nov  8 23:38:21 2011
@@ -0,0 +1,72 @@
+@comment $OpenBSD$
+@bin bin/grafx2
+share/grafx2/fonts/8pxfont.png
+share/grafx2/fonts/PF_Westa_7__.png
+share/grafx2/fonts/PF_Westa_7_.png
+share/grafx2/fonts/PF_Tempesta_7___.png
+share/grafx2/fonts/PF_Tempesta_7__.png
+share/grafx2/fonts/PF_Tempesta_7_.png
+share/grafx2/fonts/PF_Tempesta_7.png
+share/grafx2/fonts/PF_Tempesta_5___.png
+share/grafx2/fonts/PF_Tempesta_5__.png
+share/grafx2/fonts/PF_Tempesta_5_.png
+share/grafx2/fonts/PF_Tempesta_5.png
+share/grafx2/fonts/PF_Ronda_7__.png
+share/grafx2/fonts/PF_Easta_7__.png
+share/grafx2/fonts/PF_Easta_7_.png
+share/grafx2/fonts/PF_Arma_5__.png
+share/grafx2/fonts/Tuffy.ttf
+share/grafx2/skins/skin_classic.png
+share/grafx2/skins/font_Seen.png
+share/grafx2/skins/skin_scenish.png
+share/grafx2/skins/font_DPaint.png
+share/grafx2/skins/font_Melon.png
+share/grafx2/skins/font_Fairlight.png
+share/grafx2/skins/font_Fun.png
+share/grafx2/skins/font_Classic.png
+share/grafx2/skins/skin_DPaint.png
+share/grafx2/skins/skin_modern.png
+share/grafx2/skins/skin_Aurora.png
+share/grafx2/scripts/samples_2.3/brush/ApplyColor.lua
+share/grafx2/scripts/samples_2.3/brush/Fisheye.lua
+share/grafx2/scripts/samples_2.3/brush/GrayscaleAvg.lua
+share/grafx2/scripts/samples_2.3/brush/GrayscaleDesat.lua
+share/grafx2/scripts/samples_2.3/brush/Halfsmooth.lua
+share/grafx2/scripts/samples_2.3/brush/Waves.lua
+share/grafx2/scripts/samples_2.3/demo/brush/Amigaball.lua
+share/grafx2/scripts/samples_2.3/demo/brush/ColorSphere.lua
+share/grafx2/scripts/samples_2.3/demo/brush/FindAA.lua
+share/grafx2/scripts/samples_2.3/demo/brush/Mandelbrot.lua
+share/grafx2/scripts/samples_2.3/demo/3DPalette.lua
+share/grafx2/scripts/samples_2.3/demo/Ellipse.lua
+share/grafx2/scripts/samples_2.3/demo/FlipPicture.lua
+share/grafx2/scripts/samples_2.3/demo/SierpinskyCarpet.lua
+share/grafx2/scripts/samples_2.3/demo/SierpinskyTriangle.lua
+share/grafx2/scripts/samples_2.3/demo/Spritesheet.lua
+share/grafx2/scripts/samples_2.3/libs/dawnbringer_lib.lua
+share/grafx2/scripts/samples_2.3/libs/memory.lua
+share/grafx2/scripts/samples_2.3/palette/Desaturate.lua
+share/grafx2/scripts/samples_2.3/palette/ExpandColors.lua
+share/grafx2/scripts/samples_2.3/palette/FillColorCube.lua
+share/grafx2/scripts/samples_2.3/palette/InvertedRGB.lua
+share/grafx2/scripts/samples_2.3/palette/Set3bit.lua
+share/grafx2/scripts/samples_2.3/palette/Set6bit.lua
+share/grafx2/scripts/samples_2.3/palette/SetC64Palette.lua
+share/grafx2/scripts/samples_2.3/palette/ShiftHue.lua
+share/grafx2/scripts/samples_2.3/picture/CellColourReducer.lua
+share/grafx2/scripts/samples_2.3/picture/DrawGridIsometric.lua
+share/grafx2/scripts/samples_2.3/picture/DrawgridOrthogonal_Index.lua
+share/grafx2/scripts/samples_2.3/picture/DrawGridOrthogonal_RGB.lua
+share/grafx2/scripts/samples_2.3/picture/GlassGridFilter.lua
+share/grafx2/scripts/samples_2.3/picture/PaletteToPicture.lua
+share/grafx2/scripts/samples_2.3/picture/Pic2isometric.lua
+share/grafx2/scripts/samples_2.3/picture/Rainbow-Dark2Bright.lua
+share/grafx2/scripts/samples_2.3/picture/RemapImage2RGB.lua
+share/grafx2/scripts/samples_2.3/picture/RemapImage2RGB_ed.lua
+share/grafx2/scripts/samples_2.3/picture/RemapImageTo3bitPal.lua
+share/grafx2/scripts/samples_2.3/picture/XBitColourXpaceFromPalette.lua
+share/grafx2/gfx2def.ini
+share/grafx2/gfx2.gif
+share/applications/grafx2.desktop
+share/icons/grafx2.xpm
+share/icons/grafx2.svg

Reply via email to