Description: An almost complete port to GNUstep.
 Apparently upstream has only build-tested the app on GNUstep.
 Runtime tests revealed a few GNUstep bugs -- some of them got fixed
 while others are worked around.  Some changes may not be entirely
 correct as obviously there are differences between Cocoa and GNUstep
 behavior.
 .
 The overriding of NSCell methods in SMDoubleSliderCell.m is a
 temporary workaround and should *not* be submitted upstream.  The
 NSSliderCell class was rewritten to match the Cocoa behavior but the
 change is not ABI-compatible.  When gnustep-gui/0.27 is released, the
 patch needs to be updated; no changes to SMDoubleSlider would be
 required then.  See the thread beginning at
 http://lists.gnu.org/archive/html/discuss-gnustep/2018-02/msg00023.html
 .
 Needs further testing and possibly other tweaks.
Bug-Debian: https://bugs.debian.org/483430
Bug-Debian: https://bugs.debian.org/893097
Author: Yavor Doganov <yavor@gnu.org>
Forwarded: no
Last-Update: 2018-03-16
---

--- lynkeos.app.orig/English.lproj/MyChromaticLevels.xib
+++ lynkeos.app/English.lproj/MyChromaticLevels.xib
@@ -438,7 +438,7 @@
 						<string key="NSCellSize">{15, 22}</string>
 						<string key="NSIntercellSpacing">{6, 2}</string>
 						<int key="NSMatrixFlags">67108864</int>
-						<string key="NSCellClass">NSActionCell</string>
+						<string key="NSCellClass">NSStepperCell</string>
 						<object class="NSStepperCell" key="NSProtoCell" id="135145224">
 							<int key="NSCellFlags">786464</int>
 							<int key="NSCellFlags2">131072</int>
@@ -485,7 +485,7 @@
 						<string key="NSCellSize">{15, 22}</string>
 						<string key="NSIntercellSpacing">{6, 2}</string>
 						<int key="NSMatrixFlags">67108864</int>
-						<string key="NSCellClass">NSActionCell</string>
+						<string key="NSCellClass">NSStepperCell</string>
 						<object class="NSStepperCell" key="NSProtoCell" id="649272699">
 							<int key="NSCellFlags">786464</int>
 							<int key="NSCellFlags2">131072</int>
--- lynkeos.app.orig/GNUstep/GNUmakefile
+++ lynkeos.app/GNUstep/GNUmakefile
@@ -5,8 +5,7 @@
 
 APP_NAME = Lynkeos
 
-#Lynkeos_RESOURCE_DIRS = ../GNUstep
-Lynkeos_RESOURCE_DIRS = $(PWD)
+Lynkeos_RESOURCE_FILES = ../Resources/* ../*.lproj
 
 Lynkeos_OBJC_FILES = corelation.m \
 FFmpegReader.m \
@@ -49,6 +48,10 @@
 MyImageListWindowSplitView.m \
 MyImageListWindowToolbar.m \
 MyImageStacker.m \
+MyImageStacker_Calibration.m \
+MyImageStacker_Extrema.m \
+MyImageStacker_SigmaReject.m \
+MyImageStacker_Standard.m \
 MyImageStackerPrefs.m \
 MyImageStackerView.m \
 MyImageView.m \
@@ -56,6 +59,7 @@
 MyListManagement.m \
 MyLucyRichardson.m \
 MyLucyRichardsonView.m \
+MyMultiPassImageEnumerator.m \
 MyPluginsController.m \
 MyProcessingThread.m \
 MyProcessStackView.m \
@@ -73,35 +77,30 @@
 
 Lynkeos_C_FILES = ProcessingUtilities.c
 
-Lynkeos_MAIN_MODEL_FILE=MainMenu.gorm
-Lynkeos_RESOURCE_FILES= $(Lynkeos_RESOURCE_DIRS)/MainMenu.gorm \
-$(Lynkeos_RESOURCE_DIRS)/ImageListWindow.gorm \
-$(Lynkeos_RESOURCE_DIRS)/MyDeconvolution.gorm \
-$(Lynkeos_RESOURCE_DIRS)/MyImageAligner.gorm \
-$(Lynkeos_RESOURCE_DIRS)/MyImageAnalyzer.gorm \
-$(Lynkeos_RESOURCE_DIRS)/MyImageStacker.gorm \
-$(Lynkeos_RESOURCE_DIRS)/MyLucyRichardson.gorm \
-$(Lynkeos_RESOURCE_DIRS)/MyProcessStackView.gorm \
-$(Lynkeos_RESOURCE_DIRS)/MyUnsharpMask.gorm \
-$(Lynkeos_RESOURCE_DIRS)/MyWavelet.gorm \
-$(Lynkeos_RESOURCE_DIRS)/TiffWriter.gorm \
-$(Lynkeos_RESOURCE_DIRS)/MyChromaticAlign.gorm \
-$(Lynkeos_RESOURCE_DIRS)/MyChromaticLevels.gorm
-
-ADDITIONAL_OBJC_LIBS += -lavcodec -lavformat -lavutil -lfftw3f_threads -lfftw3f -lm
+ADDITIONAL_GUI_LIBS += -lavcodec -lavformat -lavutil -lswscale \
+                         -lfftw3f_threads -lfftw3f -ltiff -lm -lpthread
 #ADDITIONAL_LIB_DIRS += 
 
-ADDITIONAL_OBJCFLAGS += -std=gnu99
-ADDITIONAL_CPPFLAGS += -I$(PWD)/../Sources \
+ADDITIONAL_OBJCFLAGS += -Wno-unknown-pragmas
+ADDITIONAL_CPPFLAGS += -I. -I.. -I$(PWD).. -I$(PWD)/../Sources \
 -I$(PWD)/../ThreadConnectionSources \
--I$(PWD)/../ThirdPartySources/SMDoubleSlider
+-I$(PWD)/../ThirdPartySources/SMDoubleSlider -DNO_FRAMEWORK_CHECK=1
 
 include $(GNUSTEP_MAKEFILES)/application.make
-#include $(GNUSTEP_MAKEFILES)/ctool.make
-#include $(GNUSTEP_MAKEFILES)/objc.make
-#include $(GNUSTEP_MAKEFILES)/bundle.make
 
 VPATH +=:$(PWD)/../Sources\
 :$(PWD)/../ThreadConnectionSources\
 :$(PWD)/../ThirdPartySources/SMDoubleSlider
 
+symlinks := LynkeosInfo.plist ../LynkeosCore
+
+LynkeosInfo.plist: ../Info.plist
+	$(LN_S) $< $@
+
+../LynkeosCore: ../Sources
+	$(LN_S) $(notdir $<) $@
+
+before-all:: $(symlinks)
+
+after-clean::
+	$(RM) $(symlinks)
--- lynkeos.app.orig/Sources/LynkeosFourierBuffer.m
+++ lynkeos.app/Sources/LynkeosFourierBuffer.m
@@ -22,6 +22,7 @@
 
 #ifdef GNUSTEP
 #include <sys/sysinfo.h>
+#include <unistd.h>
 #else
 #include <sys/sysctl.h>
 #include <CoreServices/CoreServices.h>
--- lynkeos.app.orig/Sources/LynkeosProcessingParameterMgr.m
+++ lynkeos.app/Sources/LynkeosProcessingParameterMgr.m
@@ -21,7 +21,7 @@
 //
 #include <errno.h>
 
-#include <objc/objc-runtime.h>
+#include <objc/runtime.h>
 #include "LynkeosThreadConnection.h"
 #include "LynkeosProcessingParameterMgr.h"
 
--- lynkeos.app.orig/Sources/MyChromaticAlignerView.m
+++ lynkeos.app/Sources/MyChromaticAlignerView.m
@@ -125,8 +125,6 @@
 @implementation MyChromaticAlignerView(Private)
 - (void) setMatrix:(NSMatrix*)matrix rows:(int)rows
 {
-   while ( [matrix numberOfRows] > rows )
-      [matrix removeRow:0];
    while ( [matrix numberOfRows] < rows )
       [matrix addRow];
 
@@ -236,7 +234,7 @@
 
 - (void) enableButtons
 {
-   BOOL isColored = (_item != nil && [_item numberOfPlanes] > 1);
+   BOOL isColored = (_originalImage != nil && [_item numberOfPlanes] > 1);
 
    [_automaticOffsetsButton setEnabled:isColored];
    // Disable "re-stack" if the item is not a list
--- lynkeos.app.orig/Sources/MyChromaticLevels.m
+++ lynkeos.app/Sources/MyChromaticLevels.m
@@ -56,9 +56,6 @@
 @implementation MyChromaticLevelsView(Private)
 - (void) setMatrix:(NSMatrix*)matrix rows:(int)rows
 {
-   while ( [matrix numberOfRows] > 0 )
-      [matrix removeRow:0];
-
    u_short i;
    for( i = 0; i < rows; i++ )
    {
@@ -68,7 +65,7 @@
       {
          NSSliderCell *proto = [matrix prototype];
          NSSliderCell *slider =
-            [[[NSSliderCell alloc] initTextCell:@""] autorelease];
+            [[[NSSliderCell alloc] init] autorelease];
          [slider setControlSize:[proto controlSize]];
          [slider setNumberOfTickMarks:7];
          [slider setTickMarkPosition:NSTickMarkBelow];
--- lynkeos.app.orig/Sources/MyCocoaFilesReader.h
+++ lynkeos.app/Sources/MyCocoaFilesReader.h
@@ -29,8 +29,8 @@
 #ifndef __MYCOCOAFILEREADER_H
 #define __MYCOCOAFILEREADER_H
 
-#include <QTKit/QTMovie.h>
 #if !defined GNUSTEP
+#include <QTKit/QTMovie.h>
 #include <AvailabilityMacros.h>
 #ifndef AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
 #error "Pas defini"
--- lynkeos.app.orig/Sources/MyCocoaFilesReader.m
+++ lynkeos.app/Sources/MyCocoaFilesReader.m
@@ -27,8 +27,10 @@
 
 #include <pthread.h>
 
+#if !GNUSTEP
 #include <QTKit/QTTrack.h>
 #include <QTKit/QTMedia.h>
+#endif
 
 #include "processing_core.h"
 #include "MyCachePrefs.h"
--- lynkeos.app.orig/Sources/MyCustomViews.m
+++ lynkeos.app/Sources/MyCustomViews.m
@@ -79,6 +79,7 @@
 
 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
 {
+#if !GNUSTEP
    NSPasteboard *pboard;
 
    pboard = [sender draggingPasteboard];
@@ -88,6 +89,7 @@
                                         options:nil];
    if ( [URLs count] != 0 )
       [(MyImageListWindow*)[[self window] delegate] addURLs:URLs];
+#endif
 
    return YES;
 }
--- lynkeos.app.orig/Sources/MyGeneralPrefs.m
+++ lynkeos.app/Sources/MyGeneralPrefs.m
@@ -49,29 +49,48 @@
 
 - (void) findSounds
 {
+#if !GNUSTEP
    NSArray *extensions = [NSSound soundUnfilteredTypes];
+   NSURL *currPath;
+#else
+   NSArray *extensions = [NSSound soundUnfilteredFileTypes];
+   NSString *currPath;
+#endif
    NSFileManager *fileMgr = [NSFileManager defaultManager];
    NSArray *librarySearchPaths;
    NSEnumerator *searchPathEnum;
-   NSURL *currPath;
    NSMutableArray *bundleSearchPaths = [NSMutableArray array];
 
    // Build the sounds paths list
+#if !GNUSTEP
    librarySearchPaths = [fileMgr URLsForDirectory:NSLibraryDirectory
                                         inDomains:NSAllDomainsMask];
+#else
+   librarySearchPaths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
+                                                            NSAllDomainsMask,
+                                                            YES);
+#endif
 
    searchPathEnum = [librarySearchPaths objectEnumerator];
    while( (currPath = [searchPathEnum nextObject]) != nil )
+#if !GNUSTEP
       [bundleSearchPaths addObject: [currPath URLByAppendingPathComponent:
                                                                     @"Sounds"]];
 
    [bundleSearchPaths addObject: [[NSBundle mainBundle] resourceURL]];
+#else
+      [bundleSearchPaths addObject: [currPath stringByAppendingPathComponent:
+                                                                    @"Sounds"]];
+
+   [bundleSearchPaths addObject: [[NSBundle mainBundle] resourcePath]];
+#endif
 
    // Memorize each sound file in each directory
    searchPathEnum = [bundleSearchPaths objectEnumerator];
    while( (currPath = [searchPathEnum nextObject]) != nil )
    {
       NSDirectoryEnumerator *bundleEnum;
+#if !GNUSTEP
       NSURL *currBundlePath;
 
       bundleEnum = [fileMgr enumeratorAtURL:currPath
@@ -79,16 +98,25 @@
                     [NSArray arrayWithObject:NSURLTypeIdentifierKey]
                                     options:0
                                errorHandler:nil];
+#else
+      NSString *currBundlePath;
+
+      bundleEnum = [fileMgr enumeratorAtPath:currPath];
+#endif
 
       if(bundleEnum)
       {
          while( (currBundlePath = [bundleEnum nextObject]) != nil )
          {
+#if !GNUSTEP
             NSString *uti;
             [currBundlePath getResourceValue:&uti
                                       forKey:NSURLTypeIdentifierKey
                                        error:NULL];
             if( [extensions containsObject:uti] )
+#else
+            if( [extensions containsObject:[currBundlePath pathExtension]] )
+#endif
                [_soundsNames addObject:[[currBundlePath lastPathComponent]
                                                 stringByDeletingPathExtension]];
          }
--- lynkeos.app.orig/Sources/MyImageListEnumerator.m
+++ lynkeos.app/Sources/MyImageListEnumerator.m
@@ -34,7 +34,7 @@
       _itemList = nil;
       _listSize = 0;
       _step = 0;
-      _skipUnselected = FALSE;
+      _skipUnselected = NO;
       _firstItem = nil;
    }
 
--- lynkeos.app.orig/Sources/MyImageListWindow.h
+++ lynkeos.app/Sources/MyImageListWindow.h
@@ -65,10 +65,15 @@
  */
 @interface MyImageListWindow : NSWindowController 
                                <LynkeosWindowController,
-                                LynkeosDocumentDelegate,
+                                LynkeosDocumentDelegate
+#if GNUSTEP
+                                >
+#else
+                                ,
                                 NSOutlineViewDataSource,
                                 NSOutlineViewDelegate,
                                 NSToolbarDelegate>
+#endif
 {
 @private
    // Related user interface objects
--- lynkeos.app.orig/Sources/MyImageListWindow.m
+++ lynkeos.app/Sources/MyImageListWindow.m
@@ -1083,6 +1083,16 @@
    LynkeosProcessingViewRegistry *reg = [procList objectAtIndex:tag];
    NSAssert( reg != nil, @"Could not find process view registry" );
 
+#if GNUSTEP
+   if ( reg->controller == NSClassFromString(@"MyImageAnalyzerView") )
+     {
+       NSRunAlertPanel( @"Unuspported functionality",
+                        @"This functionality is not supported on GNUstep yet.",
+                        nil, nil, nil );
+       return;
+     }
+#endif
+
    if ( _processingViewReg != nil && _processingViewReg == reg )
       // The selection did not change
       return;
--- lynkeos.app.orig/Sources/MyPluginsController.h
+++ lynkeos.app/Sources/MyPluginsController.h
@@ -61,7 +61,10 @@
  * @abstract This singleton loads every plugins and retrieves the helpers
  *    classes they provide.
  */
-@interface MyPluginsController : NSObject <NSToolbarDelegate>
+@interface MyPluginsController : NSObject
+#if !GNUSTEP
+                                          <NSToolbarDelegate>
+#endif
 {
    //! The readers, organized by file type as arrays sorted by priority
    //! @{
@@ -142,4 +145,4 @@
 - (NSArray*) getLoadedBundles;
 @end
 
-#endif
\ No newline at end of file
+#endif
--- lynkeos.app.orig/Sources/MyPluginsController.m
+++ lynkeos.app/Sources/MyPluginsController.m
@@ -515,14 +515,17 @@
 
 + (MyPluginsController*) defaultPluginController
 {
+   if ( myInstance )
+     return( myInstance );
+   else
+     [[self alloc] init];
+
    NSAssert( myInstance != nil, @"The plugin controller is not created" );
    return( myInstance );
 }
 
 - (id) init
 {
-   NSAssert( myInstance == nil,
-             @"The plugin controller is already instantiated" );
    if ( (self = [super init]) != nil )
    {
       _imageReadersDict = [[NSMutableDictionary dictionary] retain];
--- lynkeos.app.orig/Sources/MyProcessStackView.h
+++ lynkeos.app/Sources/MyProcessStackView.h
@@ -38,7 +38,11 @@
  *    column
  *    </ul>
  */
+#if !GNUSTEP
 @interface MyProcessStackView : NSObject <NSOutlineViewDelegate,
+#else
+@interface MyProcessStackView : NSObject <
+#endif
                                           LynkeosProcessingView,
                                           LynkeosViewDocument,
                                           LynkeosWindowController>
--- lynkeos.app.orig/Sources/MyProcessingThread.m
+++ lynkeos.app/Sources/MyProcessingThread.m
@@ -62,7 +62,7 @@
                  document :(MyDocument*)document
                 connection: (LynkeosThreadConnection*)cnx
 {
-   if ( (self = [self init]) != nil )
+   if ( (self = [super init]) != nil )
    {
       _document = document;
       _processEnded = NO;
--- lynkeos.app.orig/Sources/MyUnsharpMask.m
+++ lynkeos.app/Sources/MyUnsharpMask.m
@@ -24,7 +24,7 @@
 #include "MyGeneralPrefs.h"
 #include "LynkeosFourierBuffer.h"
 #include "LynkeosStandardImageBufferAdditions.h"
-#include <LynkeosCore/LynkeosThreadConnection.h>
+#include "LynkeosThreadConnection.h"
 
 #include "MyUnsharpMask.h"
 
--- lynkeos.app.orig/Sources/MyUserPrefsController.h
+++ lynkeos.app/Sources/MyUserPrefsController.h
@@ -40,7 +40,10 @@
  *   preferences window
  * @ingroup Controlers
  */
-@interface MyUserPrefsController : NSObject <NSToolbarDelegate>
+@interface MyUserPrefsController : NSObject
+#if !GNUSTEP
+                                            <NSToolbarDelegate>
+#endif
 {
 @private
    // GUI controls
--- lynkeos.app.orig/ThirdPartySources/SMDoubleSlider/SMDoubleSliderCell.m
+++ lynkeos.app/ThirdPartySources/SMDoubleSlider/SMDoubleSliderCell.m
@@ -18,6 +18,72 @@
 #import "SMDoubleSliderCell.h"
 #import "SMDoubleSlider.h"
 
+@implementation NSCell (Workaround)
+- (double) doubleValue
+{
+  if (_cell.has_valid_object_value == YES)
+    {
+      if ([_object_value respondsToSelector: @selector(doubleValue)])
+        {
+          return [_object_value doubleValue];
+        }
+      if ([_object_value respondsToSelector: @selector(stringValue)])
+        {
+          return [[self stringValue] doubleValue];
+        }
+    }
+  return 0;
+}
+
+- (float) floatValue
+{
+  if (_cell.has_valid_object_value == YES)
+    {
+      if ([_object_value respondsToSelector: @selector(floatValue)])
+        {
+          return [_object_value floatValue];
+        }
+      if ([_object_value respondsToSelector: @selector(stringValue)])
+        {
+          return [[self stringValue] floatValue];
+        }
+    }
+  return 0;
+}
+
+- (int) intValue
+{
+  if (_cell.has_valid_object_value == YES)
+    {
+      if ([_object_value respondsToSelector: @selector(intValue)])
+        {
+          return [_object_value intValue];
+        }
+      if ([_object_value respondsToSelector: @selector(stringValue)])
+        {
+          return [[self stringValue] intValue];
+        }
+    }
+  return 0;
+}
+
+- (NSInteger) integerValue
+{
+  if (_cell.has_valid_object_value == YES)
+    {
+      if ([_object_value respondsToSelector: @selector(integerValue)])
+        {
+          return [_object_value integerValue];
+        }
+      if ([_object_value respondsToSelector: @selector(stringValue)])
+        {
+          return [[self stringValue] integerValue];
+        }
+    }
+  return 0;
+}
+@end
+
 @interface SMDoubleSliderCell(_sm_Private)
 	// A private method to calculate the rectangle of the low knob.
 	- (NSRect)_sm_loKnobRect;
@@ -241,7 +307,7 @@
     // Make sure that the user hasn't jammed both knobs up against the minimum value.
     if ( [ self trackingLoKnob ] && NSEqualRects( loKnobRect,
                 [ self knobRectFlipped:[ controlView isFlipped ] ] ) )
-        [ self setTrackingLoKnob:( _sm_loValue > [ self minValue ] ) ];
+        [ self setTrackingLoKnob:( _sm_loValue >= [ self minValue ] ) ];
 
     // Make sure that the entire lo knob gets erased if it's moved the first time.
     if ( [ self trackingLoKnob ] )
@@ -404,6 +470,7 @@
         [ self setStringHiValue:aString ];
 }
 
+#if !GNUSTEP
 - (void)setObjectValue:(id)obj
 {
     if ( [ self trackingLoKnob ] )
@@ -411,6 +478,7 @@
     else
         [ self setObjectHiValue:obj ];
 }
+#endif
 
 - (void)setIntValue:(int)anInt
 {
--- lynkeos.app.orig/ThreadConnectionSources/LynkeosThreadConnection.h
+++ lynkeos.app/ThreadConnectionSources/LynkeosThreadConnection.h
@@ -45,7 +45,10 @@
  *    though it can be any thread.
  * @ingroup Support
  */
-@interface LynkeosThreadConnection : NSObject <NSPortDelegate>
+@interface LynkeosThreadConnection : NSObject
+#if !GNUSTEP
+                                              <NSPortDelegate>
+#endif
 {
 @private
    id _rootObject;     //!< Object controlling the connection in the main thread
--- lynkeos.app.orig/French.lproj/MyChromaticLevels.xib
+++ lynkeos.app/French.lproj/MyChromaticLevels.xib
@@ -433,7 +433,7 @@
 						<string key="NSCellSize">{15, 22}</string>
 						<string key="NSIntercellSpacing">{6, 2}</string>
 						<int key="NSMatrixFlags">67108864</int>
-						<string key="NSCellClass">NSActionCell</string>
+						<string key="NSCellClass">NSStepperCell</string>
 						<object class="NSStepperCell" key="NSProtoCell" id="850329735">
 							<int key="NSCellFlags">786464</int>
 							<int key="NSCellFlags2">131072</int>
@@ -479,7 +479,7 @@
 						<string key="NSCellSize">{15, 22}</string>
 						<string key="NSIntercellSpacing">{6, 2}</string>
 						<int key="NSMatrixFlags">67108864</int>
-						<string key="NSCellClass">NSActionCell</string>
+						<string key="NSCellClass">NSStepperCell</string>
 						<object class="NSStepperCell" key="NSProtoCell" id="749906641">
 							<int key="NSCellFlags">786464</int>
 							<int key="NSCellFlags2">131072</int>
--- lynkeos.app.orig/Spanish.lproj/MyChromaticLevels.xib
+++ lynkeos.app/Spanish.lproj/MyChromaticLevels.xib
@@ -433,7 +433,7 @@
 						<string key="NSCellSize">{15, 22}</string>
 						<string key="NSIntercellSpacing">{6, 2}</string>
 						<int key="NSMatrixFlags">67108864</int>
-						<string key="NSCellClass">NSActionCell</string>
+						<string key="NSCellClass">NSStepperCell</string>
 						<object class="NSStepperCell" key="NSProtoCell" id="1012740040">
 							<int key="NSCellFlags">786464</int>
 							<int key="NSCellFlags2">131072</int>
@@ -479,7 +479,7 @@
 						<string key="NSCellSize">{15, 22}</string>
 						<string key="NSIntercellSpacing">{6, 2}</string>
 						<int key="NSMatrixFlags">67108864</int>
-						<string key="NSCellClass">NSActionCell</string>
+						<string key="NSCellClass">NSStepperCell</string>
 						<object class="NSStepperCell" key="NSProtoCell" id="233164521">
 							<int key="NSCellFlags">786464</int>
 							<int key="NSCellFlags2">131072</int>
--- lynkeos.app.orig/Sources/MyCachePrefs.m
+++ lynkeos.app/Sources/MyCachePrefs.m
@@ -20,7 +20,7 @@
 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 //
 #ifdef GNUSTEP
-#include <sys/user.h>
+#include <unistd.h>
 #include <sys/sysinfo.h>
 #else
 #include <mach/mach.h>
@@ -57,7 +57,7 @@
    // Use 25% of the computers memory by defaults
    unsigned long long memSize;
 #ifdef GNUSTEP
-   memSize = get_phys_pages() * PAGE_SIZE;
+   memSize = get_phys_pages() * sysconf(_SC_PAGESIZE);
 #else
    host_basic_info_data_t hostInfo;
    mach_msg_type_number_t infoCount;
