Package: lynkeos.app / 3.8+dfsg-1

gnustep-port.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
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.
 .
 Code relying on CoreGraphics is #ifdef'ed out but this should be
 reverted when the GNUstep implementation, gnustep-opal, is packaged.
 .
 The support for dcraw/libraw/ffmpeg/FITS/SER formats is built in the
 app itself and not provided as separate bundles.  This is a
 deliberate choice for simplicity's sake as we'd have to move more
 files around and provide compatibility symlinks to cater for the FHS
 (and in the case of the Dcraw bundle, the symlink for /usr/bin/dcraw
 from the dcraw package).  Likewise, LynkeosCore is not built as
 framework.
.
 Needs further testing and possibly other tweaks.
Bug-Debian: https://bugs.debian.org/483430
Bug-Debian: https://bugs.debian.org/893097
Bug-Debian: https://bugs.debian.org/920609
Bug-Debian: https://bugs.debian.org/1072736
Bug-Debian: https://bugs.debian.org/1093993
Author: Yavor Doganov <yavor@gnu.org>
Forwarded: no
Last-Update: 2025-04-09
---

--- lynkeos.app.orig/application/GNUstep/GNUmakefile
+++ lynkeos.app/application/GNUstep/GNUmakefile
@@ -5,22 +5,34 @@
 
 APP_NAME = Lynkeos
 
-#Lynkeos_RESOURCE_DIRS = ../GNUstep
-Lynkeos_RESOURCE_DIRS = $(PWD)
+Lynkeos_RESOURCE_FILES = ../Resources/* ../*.lproj
 
-Lynkeos_OBJC_FILES = corelation.m \
+Lynkeos_OBJC_FILES = BayerImageBuffer.m \
+corelation.m \
+DcrawReader.m \
+DcrawReaderPrefs.m \
+FileSequenceWriter.m \
 FFmpegReader.m \
+FITSRawReader.m \
+FITSReader.m \
+FITSWriter.m \
+LibRaw_Reader.m \
+LynkeosAlertPanel.m \
 LynkeosBasicAlignResult.m \
+LynkeosBicubicInterpolator.m \
 LynkeosColumnDescriptor.m \
+LynkeosDrizzleInterpolator.m \
 LynkeosFourierBuffer.m \
 LynkeosGammaCorrecter.m \
+LynkeosImageBuffer.m \
 LynkeosImageProcessingParameter.m \
+LynkeosInterpolatorManager.m \
+LynkeosLanczosInterpolator.m \
 LynkeosLogFields.m \
 LynkeosObjectCache.m \
 LynkeosProcessableImage.m \
 LynkeosProcessingDefs.m \
 LynkeosProcessingParameterMgr.m \
-LynkeosStandardImageBuffer.m \
 main.m \
 MyAboutWindowController.m \
 MyCachePrefs.m \
@@ -49,6 +61,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 +72,7 @@
 MyListManagement.m \
 MyLucyRichardson.m \
 MyLucyRichardsonView.m \
+MyMultiPassImageEnumerator.m \
 MyPluginsController.m \
 MyProcessingThread.m \
 MyProcessStackView.m \
@@ -67,41 +84,45 @@
 MyWavelet.m \
 MyWaveletView.m \
 ProcessStackManager.m \
+SER_ImageBuffer.m \
+SER_RAW_Reader.m \
+SER_Reader.m \
+SER_ReaderPrefs.m \
+SER_Writer.m \
 LynkeosThreadConnection.m \
 SMDoubleSliderCell.m \
 SMDoubleSlider.m
 
-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
+Lynkeos_C_FILES = geometry.c \
+                  ProcessingUtilities.c \
+                  SER.c
+
+LIBRAW_LIBS := $(shell $$PKG_CONFIG libraw --libs)
+ADDITIONAL_GUI_LIBS += -lavcodec -lavformat -lavutil -lswscale -llapack \
+			 -llapacke -lfftw3f_threads -lfftw3f -ltiff -lm \
+			 -lcfitsio -lpthread $(LIBRAW_LIBS)
 #ADDITIONAL_LIB_DIRS += 
 
-ADDITIONAL_OBJCFLAGS += -std=gnu99
-ADDITIONAL_CPPFLAGS += -I$(PWD)/../Sources \
+ADDITIONAL_OBJCFLAGS += -std=gnu99 -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/application/Sources/LynkeosFourierBuffer.m
+++ lynkeos.app/application/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>
@@ -110,6 +111,9 @@
 
    // Reload FFTW wisdom
    NSFileManager *fileMgr = [NSFileManager defaultManager];
+#ifdef GNUSTEP
+   CREATE_AUTORELEASE_POOL(pool);
+#endif
    NSURL *supportDir = [fileMgr URLForDirectory:NSApplicationSupportDirectory
                                        inDomain:NSUserDomainMask
                               appropriateForURL:nil
@@ -121,19 +125,50 @@
                                   [NSString stringWithFormat:@"Lynkeos/fftw-wisdom%.2f", CURRENT_PROJECT_VERSION]];
       if (wisdomFile != nil)
       {
-         const char *wisdomPath = [wisdomFile fileSystemRepresentation];
+         const char *wisdomPath;
+#ifdef GNUSTEP
+         wisdomPath = [[wisdomFile absoluteString] fileSystemRepresentation];
+#else
+         wisdomPath = [wisdomFile fileSystemRepresentation];
+#endif
          if ([fileMgr fileExistsAtPath:
                          [NSString stringWithCString:wisdomPath encoding:NSUTF8StringEncoding]])
          FFT_IMPORT_WISDOM(wisdomPath);
 
+#if !__OBJC_GNUSTEP_RUNTIME_ABI__
+         GSNotificationBlock block;
+
+         void blockfunc(void *p, NSNotification *not)
+         {
+            const char *file;
+
+            file = [[wisdomFile absoluteString] fileSystemRepresentation];
+            FFT_EXPORT_WISDOM(file);
+            RELEASE(wisdomFile);
+         }
+
+         /* Memory leak here -- I couldn't find a way to solve it.  In
+          * practice it's not a problem because the program terminates
+          * so all memory is returned to the system.  */
+         block = malloc(sizeof(*block));
+         block->invoke = blockfunc;
+         RETAIN(wisdomFile);
+#endif
          [[NSNotificationCenter defaultCenter] addObserverForName:NSApplicationWillTerminateNotification
                                                            object:nil
                                                             queue:nil
+#if !GNUSTEP || __OBJC_GNUSTEP_RUNTIME_ABI__
                                                        usingBlock:^(NSNotification * _Nonnull note) {
             FFT_EXPORT_WISDOM([wisdomFile fileSystemRepresentation]);
          }];
+#else
+                                                       usingBlock:block];
+#endif
       }
    }
+#ifdef GNUSTEP
+  RELEASE(pool);
+#endif
 }
 
 /*!
--- lynkeos.app.orig/application/Sources/LynkeosProcessingParameterMgr.m
+++ lynkeos.app/application/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/application/Sources/MyChromaticAlignerView.m
+++ lynkeos.app/application/Sources/MyChromaticAlignerView.m
@@ -127,8 +127,6 @@
 @implementation MyChromaticAlignerView(Private)
 - (void) setMatrix:(NSMatrix*)matrix rows:(int)rows
 {
-   while ( [matrix numberOfRows] > rows )
-      [matrix removeRow:0];
    while ( [matrix numberOfRows] < rows )
       [matrix addRow];
 
@@ -238,7 +236,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/application/Sources/MyChromaticLevels.m
+++ lynkeos.app/application/Sources/MyChromaticLevels.m
@@ -26,6 +26,10 @@
 
 #include "MyChromaticLevels.h"
 
+#if GNUSTEP
+#define NSTickMarkPositionBelow NSTickMarkBelow
+#endif
+
 static NSString *commonPlanesNames[3];
 
 static const double DefaultLogGammaMax = 1.0-M_LN2/M_LN10;
@@ -56,9 +60,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 +69,7 @@
       {
          NSSliderCell *proto = [matrix prototype];
          NSSliderCell *slider =
-            [[[NSSliderCell alloc] initTextCell:@""] autorelease];
+            [[[NSSliderCell alloc] init] autorelease];
          [slider setControlSize:[proto controlSize]];
          [slider setNumberOfTickMarks:7];
          [slider setTickMarkPosition:NSTickMarkPositionBelow];
--- lynkeos.app.orig/application/Sources/MyCocoaFilesReader.h
+++ lynkeos.app/application/Sources/MyCocoaFilesReader.h
@@ -29,8 +29,8 @@
 #ifndef __MYCOCOAFILEREADER_H
 #define __MYCOCOAFILEREADER_H
 
-#include <AVFoundation/AVFoundation.h>
 #if !defined GNUSTEP
+#include <AVFoundation/AVFoundation.h>
 #include <AvailabilityMacros.h>
 #ifndef AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
 #error "Pas defini"
--- lynkeos.app.orig/application/Sources/MyCustomViews.m
+++ lynkeos.app/application/Sources/MyCustomViews.m
@@ -81,6 +81,7 @@
 
 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
 {
+#if !GNUSTEP
    NSPasteboard *pboard;
 
    pboard = [sender draggingPasteboard];
@@ -90,6 +91,7 @@
                                         options:nil];
    if ( [URLs count] != 0 )
       [(MyImageListWindow*)[[self window] delegate] addURLs:URLs];
+#endif
 
    return YES;
 }
--- lynkeos.app.orig/application/Sources/MyImageListEnumerator.m
+++ lynkeos.app/application/Sources/MyImageListEnumerator.m
@@ -34,7 +34,7 @@
       _itemList = nil;
       _listSize = 0;
       _step = 0;
-      _skipUnselected = FALSE;
+      _skipUnselected = NO;
       _firstItem = nil;
       _itemIndex = NSNotFound;
       _currentContainer = nil;
--- lynkeos.app.orig/application/Sources/MyImageListWindow.m
+++ lynkeos.app/application/Sources/MyImageListWindow.m
@@ -52,7 +52,11 @@
 static NSString * const K_PROCESSHEIGHT_KEY = @"process height";
 static NSString * const K_COLUMNSWIDTH_KEY = @"columns width";
 
+#if !GNUSTEP
 const CFStringRef LynkeosName = CFSTR("Lynkeos");
+#else
+#define NSAlertStyleCritical NSCriticalAlertStyle
+#endif
 
 static NSCursor *myWatchCursor = nil;
 
@@ -408,9 +412,11 @@
 
       BOOL nextEnabled = [[_currentList imageArray] count] != 0;
 
+#if !GNUSTEP
       if ((theEvent.modifierFlags & NSEventModifierFlagDeviceIndependentFlagsMask
            & ~NSEventModifierFlagNumericPad & ~NSEventModifierFlagFunction) == 0)
       {
+#endif
          switch( c )
          {
             case NSLeftArrowFunctionKey:
@@ -452,9 +458,11 @@
                [super keyDown:theEvent];
                break;
          }
+#if !GNUSTEP
       }
       else
          [super keyDown:theEvent];
+#endif
    }
    else
       [super keyDown:theEvent];
@@ -1085,11 +1093,13 @@
 
       NSMutableDictionary *mDict
          = [NSMutableDictionary dictionaryWithDictionary:[list getMetaData]];
+#if !GNUSTEP
       NSArray *app = [mDict objectForKey:LynkeosMD_CreatorApp()];
       if (app == nil)
          [mDict setObject:[NSArray arrayWithObject:(NSString*)LynkeosName] forKey:LynkeosMD_CreatorApp()];
       else if (![app containsObject:(NSString*)LynkeosName])
          [mDict setObject:[app arrayByAddingObject:(NSString*)LynkeosName] forKey:LynkeosMD_CreatorApp()];
+#endif
 
       // Allocate a writer instance
       writer = (id <LynkeosMovieFileWriter>)[writerClass
@@ -1528,11 +1538,13 @@
 
    NSMutableDictionary *mDict
       = [NSMutableDictionary dictionaryWithDictionary:[item getMetaData]];
+#if !GNUSTEP
    NSArray *app = [mDict objectForKey:LynkeosMD_CreatorApp()];
    if (app == nil)
       [mDict setObject:[NSArray arrayWithObject:LynkeosName] forKey:LynkeosMD_CreatorApp()];
    else if (![app containsObject:LynkeosName])
       [mDict setObject:[app arrayByAddingObject:LynkeosName] forKey:LynkeosMD_CreatorApp()];
+#endif
 
    // Save it
    [self saveImage:img withBlack:black white:white gamma:gamma metadata:mDict];
@@ -1653,7 +1665,7 @@
       *planes = (const REAL * const *)[ctrl->sample colorPlanes];
       *lineW = ctrl->sample->_padw;
 
-      _exportProgressIndicator.doubleValue += 1.0;
+      [_exportProgressIndicator setDoubleValue:[_exportProgressIndicator doubleValue] + 1.0];
       if ([NSApp runModalSession: _exportProgressSession] == NSModalResponseCancel)
          *canceled = YES;
    }
--- lynkeos.app.orig/application/Sources/MyPluginsController.m
+++ lynkeos.app/application/Sources/MyPluginsController.m
@@ -24,17 +24,15 @@
 
 #include <GNUstepBase/GSObjCRuntime.h>
 
-#define getClassList(c,n) GSClassList(c, n, NO)
-
 #else
 
 #include <Carbon/Carbon.h>
 #include <objc/objc-runtime.h>
 
-#define getClassList(c,n) objc_getClassList(c, n);
-
 #endif
 
+#define getClassList(c,n) objc_getClassList(c, n);
+
 #include "processing_core.h"
 #include "LynkeosFileReader.h"
 #include "LynkeosFileWriter.h"
@@ -475,7 +473,11 @@
       NSString *helpBook = [bundle objectForInfoDictionaryKey: @"CFBundleHelpBookName"];
       if (helpBook != nil)
       {
+#if !GNUSTEP
          BOOL success = [[NSHelpManager sharedHelpManager] registerBooksInBundle:bundle];
+#else
+         BOOL success = NO;
+#endif
          if (success)
          {
             NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:
@@ -504,14 +506,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/application/Sources/MyProcessingThread.m
+++ lynkeos.app/application/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/application/Sources/MyUnsharpMask.m
+++ lynkeos.app/application/Sources/MyUnsharpMask.m
@@ -24,7 +24,7 @@
 #include "MyGeneralPrefs.h"
 #include "LynkeosFourierBuffer.h"
 #include "LynkeosImageBufferAdditions.h"
-#include <LynkeosCore/LynkeosThreadConnection.h>
+#include "LynkeosThreadConnection.h"
 
 #include "MyUnsharpMask.h"
 
--- lynkeos.app.orig/application/Sources/MyCachePrefs.m
+++ lynkeos.app/application/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;
--- lynkeos.app.orig/application/Sources/SER.h
+++ lynkeos.app/application/Sources/SER.h
@@ -25,6 +25,7 @@
 #define __SER_H
 
 #include <stdio.h>
+#include <stdint.h>
 
 #define SER_ID_LENGTH 14
 #define SER_STRING_LENGTH 40
--- lynkeos.app.orig/application/Sources/FFmpegReader.m
+++ lynkeos.app/application/Sources/FFmpegReader.m
@@ -23,7 +23,9 @@
 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 // 
 
+#if !GNUSTEP
 #include <AVFoundation/AVFoundation.h>
+#endif
 #import <AppKit/NSGraphics.h>
 
 #include <libavutil/imgutils.h>
@@ -290,15 +292,24 @@
    void *opaque = NULL;
 
    // Start the list with obvious file types, in case the introspection would fail
+#if !GNUSTEP
    *fileTypes = [NSMutableArray arrayWithObjects: @"avi",@"mpeg",@"mpg",@"mp4",@"wmv",@"mov",
                  AVFileTypeQuickTimeMovie, AVFileTypeMPEG4, AVFileTypeAppleM4V, nil];
+#else
+   *fileTypes = [NSMutableArray arrayWithObjects:
+                                  @"avi",@"mpeg",@"mpg",@"mp4",@"wmv",@"mov",nil];
+#endif
    while ((fmt = av_demuxer_iterate(&opaque)))
    {
       if (fmt->extensions != NULL)
       {
          // Filtering only the formats with video capacity did not work... get them all
          NSString *extensions = [NSString stringWithUTF8String:fmt->extensions];
-         NSArray<NSString *> *extList = [extensions componentsSeparatedByString:@","];
+         NSArray
+#if !GNUSTEP
+<NSString *>
+#endif
+           *extList = [extensions componentsSeparatedByString:@","];
          NSEnumerator *extEnum = [extList objectEnumerator];
          NSString *ext;
          while( (ext = [extEnum nextObject]) != nil )
--- lynkeos.app.orig/application/Sources/MyCocoaFilesReader.m
+++ lynkeos.app/application/Sources/MyCocoaFilesReader.m
@@ -70,9 +70,18 @@
    [offScreenImage lockFocus];
 
    // Force graphic context into low resolution mode
+#if !GNUSTEP
    CGContextRef g = [NSGraphicsContext currentContext].CGContext;
    const CGAffineTransform t = CGContextGetCTM(g);
    const CGFloat det = t.a*t.d - t.b*t.c;
+#else
+#ifndef __fp16
+#define __fp16 float
+#endif
+   const NSAffineTransformStruct t
+     = [[GSCurrentContext() GSCurrentCTM] transformStruct];
+   const CGFloat det = t.m11*t.m22 - t.m12*t.m21;
+#endif
    if (det > 0.0)
    {
       const CGFloat scale = sqrt(det);
--- lynkeos.app.orig/application/Sources/MyDocument.m
+++ lynkeos.app/application/Sources/MyDocument.m
@@ -43,6 +43,10 @@
 // Needed for setting calibration frames align offset (it's a bad hack)
 #include "MyImageAligner.h"
 
+#if GNUSTEP
+#define NSAlertStyleCritical NSCriticalAlertStyle
+#endif
+
 #define K_DOCUMENT_TYPE		@"Lynkeos project"
 
 enum {ThreadsIdle, ThreadsStarted};
@@ -359,6 +363,7 @@
 //==============================================================================
 // Document load and save
 //==============================================================================
+#if !GNUSTEP
 - (void) saveToURL:(NSURL *)url ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation
  completionHandler:(void (^)(NSError * _Nullable))completionHandler
 {
@@ -372,6 +377,23 @@
 
    basePath = nil;
 }
+#else
+- (BOOL)saveToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName
+ forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError **)outError
+{
+    if ( saveOperation != NSAutosaveOperation )
+      basePath = [[absoluteURL path] stringByDeletingLastPathComponent];
+   else
+      basePath = nil;
+
+   BOOL res = [super saveToURL:absoluteURL ofType:typeName
+              forSaveOperation:saveOperation error:outError];
+
+    basePath = nil;
+
+    return( res );
+}
+#endif
 
 - (BOOL) readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError
 {
@@ -380,7 +402,11 @@
    // if the absolute URL read did fail.
    basePath = [[absoluteURL path] stringByDeletingLastPathComponent];
 
+#if !GNUSTEP
    NSFileWrapper *wrap = [[[NSFileWrapper alloc] initWithURL:absoluteURL options:0 error:outError] autorelease];
+#else
+   NSFileWrapper *wrap = [[[NSFileWrapper alloc] initWithPath:[absoluteURL path]] autorelease];
+#endif
    BOOL res = (*outError == nil) && [self readFromFileWrapper:wrap ofType:typeName error:outError];
 
    basePath = nil;
@@ -388,7 +414,11 @@
    return( res );
 }
 
+#if !GNUSTEP
 - (nullable NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError;
+#else
+- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError;
+#endif
 {
    MyDocumentDataV2 *myData;
 
--- lynkeos.app.orig/application/Sources/MyImageAligner.m
+++ lynkeos.app/application/Sources/MyImageAligner.m
@@ -23,7 +23,11 @@
  * @abstract Image alignment process implementation
  */
 #include <objc/runtime.h>
+#if !GNUSTEP
 #include <Accelerate/Accelerate.h>
+#else
+#include <lapacke.h>
+#endif
 
 #include "processing_core.h"
 #include "corelation.h"
@@ -327,7 +331,7 @@
       _alignSquares = [[NSMutableArray array] retain];
       _referenceItem = nil;
       _alignLock = [[NSLock alloc] init];
-      _dataReady = FALSE;
+      _dataReady = NO;
       _squaresData = [[NSMutableArray array] retain];
       _cutoff = 0.0;
       _precisionThreshold = 0.0;
@@ -839,9 +843,18 @@
                // Perform a singular value decomposition on the covariances
                char job = 'A';
                int dim = 2, lwork = 10;
+#if !GNUSTEP
                int status = dgesvd_(&job, &job, &dim, &dim, covariances, &dim,
                                     s, u, &dim, vt, &dim, work, &lwork, &info);
                NSAssert(status == 0, @"Singular value decomposition failed");
+#else
+               dgesvd_(&job, &job, &dim, &dim, covariances, &dim,
+                       s, u, &dim, vt, &dim, work, &lwork, &info
+#ifdef LAPACK_FORTRAN_STRLEN_END
+                       , strlen(&job), strlen(&job)
+#endif
+                       );
+#endif
 
                // The final rotation matrix is U * V' (with a positive
                // determinant)
--- lynkeos.app.orig/application/Sources/MyImageListItem.m
+++ lynkeos.app/application/Sources/MyImageListItem.m
@@ -804,6 +804,7 @@
       return NO;
 }
 
+#if !GNUSTEP
 - (CGImageRef) getImageTileInRect:(CGRect)rect
 {
    CGImageRef image = NULL;
@@ -830,6 +831,27 @@
 
    return( image );
 }
+#else
+- (NSImage*) getNSImage
+{
+   NSImage *image = nil;
+
+   if ( _processedImage != nil || _processedSpectrum != nil )
+      image = [super getNSImage];
+
+   else if ( _childList != nil )
+      // No image at movie level
+      ;
+   else if ( _index == NSNotFound )
+      // Image file
+      image = [_reader getNSImage];
+   else
+      // Movie image
+      image = [_reader getNSImageAtIndex:_index];
+
+   return( image );
+}
+#endif
 
 - (void) getImageSample:(LynkeosImageBuffer**)buffer
                  inRect:(LynkeosIntegerRect)rect
@@ -1020,7 +1042,7 @@
    args->offsets = (NSPoint*)malloc(sizeof(NSPoint)*(*buffer)->_nPlanes);
       for (i = 0; i < (*buffer)->_nPlanes; i++)
       {
-         args->offsets[i] = (offsets != NULL ? offsets[i] : CGPointMake(0.0, 0.0));
+         args->offsets[i] = (offsets != NULL ? offsets[i] : NSMakePoint(0.0, 0.0));
       }
    args->y = 0;
    args->lock = nil;
--- lynkeos.app.orig/application/Sources/SER_ImageBuffer.m
+++ lynkeos.app/application/Sources/SER_ImageBuffer.m
@@ -20,12 +20,17 @@
 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 //
 
-#include <objc/objc-class.h>
+#include <objc/runtime.h>
 
 #include <LynkeosCore/LynkeosInterpolator.h>
 
 #include "SER_ImageBuffer.h"
 
+#if GNUSTEP
+#define nonnull
+#define nullable
+#endif
+
 const NSString *WeightKey = @"weight";
 const NSString *SubstractiveKey = @"substractive";
 
@@ -252,12 +257,21 @@
 
 - (u_short) numberOfPlanes {return 3;}
 
+#if !GNUSTEP
 - (CGImageRef) getImageInRect:(LynkeosIntegerRect)r
                     withBlack:(double*)black white:(double*)white gamma:(double*)gamma
+#else
+- (NSBitmapImageRep*) getNSImageWithBlack:(double*)black white:(double*)white
+                                    gamma:(double*)gamma
+#endif
 {
    LynkeosImageBuffer *img = [self planarImage];
 
+#if !GNUSTEP
    return [img getImageInRect:r withBlack:black white:white gamma:gamma];
+#else
+   return [img getNSImageWithBlack:black white:white gamma:gamma];
+#endif
 }
 
 - (void) add :(LynkeosImageBuffer*)image
--- lynkeos.app.orig/application/Sources/SER_Reader.m
+++ lynkeos.app/application/Sources/SER_Reader.m
@@ -20,6 +20,13 @@
 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 // 
 
+#if GNUSTEP
+#include <stdint.h>
+#include <CoreFoundation/CFByteOrder.h>
+#define uint8 uint8_t
+#define uint16 uint16_t
+#endif /* GNUSTEP */
+
 #include <LynkeosCore/LynkeosProcessing.h>
 #include <LynkeosCore/LynkeosMetadata.h>
 #include <LynkeosCore/LynkeosInterpolator.h>
@@ -147,6 +154,7 @@
       _bytesPerRow = _width * _bytesPerPixel;
 
       // Retrieve metadata
+#if !GNUSTEP
       if (strnlen(ser.Observer, SER_STRING_LENGTH) != 0)
          [_metadata setObject:[NSArray arrayWithObject:[NSString stringWithCString:ser.Observer
                                                                           encoding:NSUTF8StringEncoding]]
@@ -161,6 +169,7 @@
          [_metadata setObject:[NSDate dateWithTimeIntervalSinceReferenceDate:
                                   (NSTimeInterval)(ser.DateTime_UTC - SER_DATE_ORIGIN)*SER_DATE_TIMEBASE]
                        forKey:LynkeosMD_CaptureDate()];
+#endif
    }
 
    return( self );
--- lynkeos.app.orig/application/Sources/DcrawReader.m
+++ lynkeos.app/application/Sources/DcrawReader.m
@@ -28,6 +28,10 @@
 #include "DcrawReaderPrefs.h"
 #include "DcrawReader.h"
 
+#if GNUSTEP
+#include <CoreFoundation/CFByteOrder.h>
+#endif /* GNUSTEP */
+
 #define K_COUNTER_KEY @"ImageCount"
 
 static NSMutableArray *rawFilesTypes = nil;
@@ -35,7 +39,7 @@
 static NSCursor *watchCursor = nil;
 static NSPanel *progressPanel = nil;
 static NSProgressIndicator *progressIndicator = nil;
-static NSModalSession progressSession = nil;
+static NSModalSession progressSession = 0;
 static NSMutableArray *pendingConversions = nil, *ongoingConversions = nil;
 static u_short maxConversions = 0;
 static NSTimer *convWaitTimer = nil;
@@ -209,8 +213,12 @@
    NSAssert(infoTask != nil, @"Failed to create a task to get RAW info");
 
    // Set its executable path to dcraw in our ressources
+#if !GNUSTEP
    NSString *dcrawPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"dcraw"
                                                                           ofType:nil];
+#else
+   NSString *dcrawPath = @"dcraw";
+#endif
    [infoTask setLaunchPath:dcrawPath];
 
    // Connect its output to a pipe
@@ -291,6 +299,7 @@
                _baseHeight = h;
             }
          }
+#if !GNUSTEP
          else if ( [token isEqualToString:@"Camera"] )
          {
             NSString *camera;
@@ -332,6 +341,7 @@
             if ( [scan scanInt:&iso] )
                 [_metadata setObject: [NSNumber numberWithInt:iso] forKey: LynkeosMD_ISOSpeed()];
          }
+#endif
          // TODO : get the remaining info
 
          [scan scanUpToCharactersFromSet: [NSCharacterSet newlineCharacterSet]
@@ -367,9 +377,13 @@
          NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
 
          // Set its executable path to dcraw in our ressources
+#if !GNUSTEP
          NSString *dcrawPath
             = [[NSBundle bundleForClass:[self class]] pathForResource:@"dcraw"
                                                                ofType:nil];
+#else
+         NSString *dcrawPath = @"dcraw";
+#endif
          [_dcrawTask setLaunchPath:dcrawPath];
 
          // Create an empty file by this name
@@ -462,6 +476,7 @@
       if (convWaitTimer != nil)
          [convWaitTimer invalidate];
 
+#if !GNUSTEP
       convWaitTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 repeats:NO block:
                        ^(NSTimer *timer)
                        {
@@ -479,9 +494,35 @@
 
                           isWaitingConversion = NO;
                        }];
+#else
+      convWaitTimer = [NSTimer scheduledTimerWithTimeInterval:0.5
+                                                       target:self
+                                                     selector:@selector(_wait:)
+                                                     userInfo:nil
+                                                      repeats:NO];
+#endif
    }
 }
 
+#if GNUSTEP
+- (void) _wait:(NSTimer*)sender
+{
+  isWaitingConversion = YES;
+  convWaitTimer = nil;
+
+  [progressIndicator stopAnimation:self];
+  [progressIndicator setIndeterminate:NO];
+
+  while ([ongoingConversions count] > 0)
+    {
+      DcrawReader *firstConv = [ongoingConversions objectAtIndex:0];
+      [firstConv waitForConversion];
+    }
+
+  isWaitingConversion = NO;
+}
+#endif
+
 - (void) waitForConversion
 {
    // If the conversion is not finished, wait for its completion
@@ -543,7 +584,7 @@
       _dcrawTask = nil;
 
       [ongoingConversions removeObject:self];
-      progressIndicator.doubleValue += 1.0;
+      [progressIndicator setDoubleValue:[progressIndicator doubleValue] + 1.0];
 
       // Find the next image to convert, if any
       DcrawReader *nextReader = nil;
@@ -561,10 +602,10 @@
       {
 //         [NSApp runModalSession:progressSession];
 //         [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.2]];
-         if (progressSession != nil)
+         if (progressSession)
          {
             [NSApp endModalSession:progressSession];
-            progressSession = nil;
+            progressSession = 0;
          }
          [progressPanel close];
       }
@@ -713,7 +754,7 @@
       _url = [url retain];
 
       // If not yet done, pop the load progress panel
-      if ( progressSession == nil )
+      if ( progressSession == 0 )
       {
          progressIndicator.maxValue = 0.0;
          progressIndicator.doubleValue = 0.0;
@@ -726,7 +767,7 @@
          [NSApp runModalSession:progressSession];
 
       // Count the ongoing conversions
-      progressIndicator.maxValue += 1.0;
+      [progressIndicator setMaxValue:[progressIndicator maxValue] + 1.0];
    }
 
    return( self );
@@ -856,7 +897,7 @@
 
    // Create a RGB bitmap
    bitmap =
-      [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil
+      [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
                                                pixelsWide:_width
                                                pixelsHigh:_height
                                             bitsPerSample:8
@@ -992,8 +1033,10 @@
                     asMode:(ListMode_t)mode
 {
    u_short w, h, n, nref;
+#if !GNUSTEP
    NSString *camera
       = [[reader getMetaData] objectForKey:LynkeosMD_CameraModel()];
+#endif
 
    if ( mode == DarkFrameMode )
       nref = 1;
@@ -1004,8 +1047,10 @@
    [reader imageWidth:&w height:&h];
 
    return( [reader isKindOfClass:[self class]]
+#if !GNUSTEP
            && [[_metadata objectForKey:LynkeosMD_CameraModel()]
                                                          isEqualToString:camera]
+#endif
            && n == nref && w == _baseWidth && h == _baseHeight );
 }
 
--- lynkeos.app.orig/application/Sources/DcrawReaderPrefs.m
+++ lynkeos.app/application/Sources/DcrawReaderPrefs.m
@@ -120,11 +120,15 @@
                        icon:(NSImage**)icon
                         tip:(NSString**)tip
 {
+#if !GNUSTEP
    NSBundle *myBundle = [NSBundle bundleWithIdentifier:
                                          @"net.sourceforge.lynkeos.plugin.RAW"];
-   *title = @"RAW";
    *icon = [[[NSImage alloc] initWithContentsOfFile:
                          [myBundle pathForImageResource:@"Dcraw"]] autorelease];
+#else
+   *icon = [NSImage imageNamed:@"Dcraw"];
+#endif
+   *title = @"RAW";
    *tip = nil;
 }
 
--- lynkeos.app.orig/application/Sources/LynkeosImageBuffer.h
+++ lynkeos.app/application/Sources/LynkeosImageBuffer.h
@@ -172,8 +172,13 @@
  * @param gamma Gamma correction exponent  for each plane (ie: 1 = no correction)
  * @result The 8 bits RGB bitmap representation of the buffer data
  */
+#if !GNUSTEP
 - (CGImageRef) getImageInRect:(LynkeosIntegerRect)rect
                     withBlack:(double*)black white:(double*)white gamma:(double*)gamma;
+#else
+- (NSBitmapImageRep*) getNSImageWithBlack:(double*)black white:(double*)white
+                                    gamma:(double*)gamma;
+#endif
 
 /*!
  * @abstract Change the strategy of processing
--- lynkeos.app.orig/application/Sources/LynkeosProcessableImage.m
+++ lynkeos.app/application/Sources/LynkeosProcessableImage.m
@@ -272,17 +272,35 @@
    return (_processedSpectrum == nil && _processedImage != nil);
 }
 
+#if !GNUSTEP
 - (CGImageRef) getImageTileInRect:(CGRect)rect;
 {
    CGImageRef image = NULL;
+#else
+- (NSImage*) getNSImage
+{
+   NSImage *image = nil;
+#endif
 
    // Perform inverse transform now if needed
    if ( _processedSpectrum != nil )
       [self goIntoImageSpace];
 
    if ( _processedImage != nil && _white[_nPlanes] > _black[_nPlanes] )
+#if !GNUSTEP
       image = [_processedImage getImageInRect:LynkeosIntegerRectFromNSRect(rect)
                                     withBlack:_black white:_white gamma:_gamma];
+#else
+   {
+      image = [[[NSImage alloc] initWithSize:
+                                       NSMakeSize([_processedImage width],
+                                                  [_processedImage height])]
+                                                                   autorelease];
+      [image addRepresentation:[_processedImage getNSImageWithBlack:_black
+                                                            white:_white
+                                                            gamma:_gamma]];
+   }
+#endif
 
    return image;
 }
--- lynkeos.app.orig/application/Sources/LynkeosProcessing.h
+++ lynkeos.app/application/Sources/LynkeosProcessing.h
@@ -339,7 +339,11 @@
  * @abstract Returns an image tile for displaying.
  * @result A CGImage built from the processed image data.
  */
+#if !GNUSTEP
 - (CGImageRef) getImageTileInRect:(CGRect)rect;
+#else
+- (NSImage*) getNSImage;
+#endif
 
 /*!
  * @abstract Read a calibrated sample from an image
--- lynkeos.app.orig/application/Sources/LynkeosImageBuffer.m
+++ lynkeos.app/application/Sources/LynkeosImageBuffer.m
@@ -437,6 +437,7 @@
       .vectProcessOneLine = vect_image_bias_scale_one_line,
       .scalar = YES};
 
+#if !GNUSTEP
 @interface ImageTileInfo : NSObject
 {
 @public
@@ -496,6 +497,7 @@
 {
    [(ImageTileInfo*)info release];
 }
+#endif
 
 /*!
  * @abstract Phases of the parallel processing for the lock condition
@@ -560,6 +562,7 @@
 @implementation ParallelImageProcessData
 @end
 
+#if !GNUSTEP
 @implementation ImageTileInfo
 
 - (id) initInRect:(LynkeosIntegerRect)rect
@@ -595,6 +598,7 @@
    [super dealloc];
 }
 @end
+#endif
 
 @implementation LynkeosImageBuffer(Private)
 /*!
@@ -1092,6 +1096,7 @@
    return( (REAL * const * const)_planes );
 }
 
+#if !GNUSTEP
 - (CGImageRef) getImageInRect:(LynkeosIntegerRect)rect
                     withBlack:(double*)black white:(double*)white gamma:(double*)gamma
 {
@@ -1127,6 +1132,74 @@
 
    return( img );
 }
+#else
+- (NSBitmapImageRep*) getNSImageWithBlack:(double*)black white:(double*)white
+                                    gamma:(double*)gamma
+{
+   const u_short nPlanes = (_nPlanes <= 3 ? _nPlanes : 3);
+   NSBitmapImageRep* bitmap;
+   u_char *pixels;
+   u_short x, y, c;
+   int bpp, bpr;
+   double vmin, vmax;
+
+   // Create a bitmap
+   bitmap = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
+                                                     pixelsWide:_w
+                                                     pixelsHigh:_h
+                                                  bitsPerSample:8
+                                                samplesPerPixel:3
+                                                       hasAlpha:NO
+                                                       isPlanar:NO
+                                                 colorSpaceName:NSCalibratedRGBColorSpace
+                                                    bytesPerRow:0
+                                                   bitsPerPixel:0]
+             autorelease];
+   // Retrieve the geometry allocated by the runtime
+   bpp = (int)[bitmap bitsPerPixel];
+   bpr = (int)[bitmap bytesPerRow];
+   NSAssert( (bpp%8) == 0,
+             @"Hey, I do not intend to work on non byte boundaries" );
+   bpp /= 8;
+
+   // Copy the pixels
+   pixels = [bitmap bitmapData];
+   const double a = (white[_nPlanes] > black[_nPlanes] ? 1.0/(white[_nPlanes] - black[_nPlanes]) : 0.0);
+
+   [self getMinLevel:&vmin maxLevel:&vmax];
+   for( c = 0; c < nPlanes; c++ )
+   {
+      const double ac = (white[c] > black[c] ? (vmax - vmin)/(white[c] - black[c]) : 0.0);
+      LynkeosGammaCorrecter *gammaCorrect =
+          [LynkeosGammaCorrecter getCorrecterForGamma:gamma[_nPlanes]*gamma[c]];
+
+      for( y = 0; y < _h; y++ )
+      {
+         for( x = 0; x < _w; x++ )
+         {
+            u_char v = screenCorrectedValue( gammaCorrect,
+                                    ( (colorValue(self,x,y,c) - black[c])*ac
+                                      + _min[_nPlanes] - black[_nPlanes] ) * a);
+            if ( _nPlanes != 1 )
+               pixels[y*bpr+x*bpp+c] = v;
+
+            // Convert monochrome image to RGB representation
+            else
+            {
+               u_short p;
+               for( p = 0; p < 3; p++ )
+                  pixels[y*bpr+x*bpp+p] = v;
+
+            }
+         }
+      }
+
+      [gammaCorrect releaseCorrecter];
+   }
+
+   return( bitmap );
+}
+#endif
 
 - (void) substract:(LynkeosImageBuffer*)image
 {
--- lynkeos.app.orig/application/Sources/MyImageAnalyzerView.m
+++ lynkeos.app/application/Sources/MyImageAnalyzerView.m
@@ -173,7 +173,11 @@
    id <LynkeosProcessableItem> item = [_window highlightedItem];
    LynkeosIntegerRect selRect = LynkeosMakeIntegerRect(0,0,0,0);
 
+#if !GNUSTEP
    if ( item != nil && [item hasImage] )
+#else
+   if ( item != nil && [item getNSImage] != nil )
+#endif
    {
       // Highlight is valid
       MyImageAnalyzerParameters *params =
--- lynkeos.app.orig/application/Sources/MyImageView.h
+++ lynkeos.app/application/Sources/MyImageView.h
@@ -129,10 +129,15 @@
 
    // Image management
    NSAffineTransform*         _imageTransform;   //!< Additional transform
+#if GNUSTEP
+   NSImageRep*                _imageRep;         //!< Cached representation
+#endif
    NSRect                     _canvasRect;       //!< Rectangle in which the image fits after transformation
+#if !GNUSTEP
    NSOperationQueue*          _tilesQueue;       //!< Operation queue used to retrieve the image tiles
    CGContextRef               _layerContext;     //!< Bitmap context for the layer
    CGLayerRef                 _imageLayer;       //!< Layer accumulating the successive tiles
+#endif
 	uint8_t*                   _drawnTile;        //!< Bookkeeping of tiles update
 	u_short                    _tilePerLine;
 
--- lynkeos.app.orig/application/Sources/MyImageView.m
+++ lynkeos.app/application/Sources/MyImageView.m
@@ -31,6 +31,7 @@
 
 static const double MM_LN_10 = -M_LN10;
 
+#if !GNUSTEP
 @interface ImageViewTile : NSObject
 {
 @public
@@ -72,6 +73,7 @@
       [_view applyTileAt:_requestedReq.origin];
 }
 @end
+#endif
 
 /*!
  * @abstract Zoom management part of MyImageView.
@@ -94,6 +96,7 @@
 - (void) stepZoom :(double)step;
 @end
 
+#if !GNUSTEP
 @implementation MyImageView(Tile)
 - (void) applyTileAt:(CGPoint)at
 {
@@ -145,6 +148,7 @@
    }
 }
 @end
+#endif
 
 @implementation MyImageView(Zoom)
 
@@ -272,11 +276,15 @@
    _itemSequenceNumber = 0;
    _itemSize = LynkeosMakeIntegerSize(0, 0);
    _imageTransform = nil;
+#if GNUSTEP
+   _imageRep = nil;
+#else
    _tilesQueue = [[NSOperationQueue alloc] init];
    _layerContext = NULL;
    _imageLayer = NULL;
    _drawnTile = NULL;
    _tilePerLine = 0;
+#endif
 
    _zoom = 1.0;
 
@@ -293,13 +301,19 @@
 
    [self initCursors];
 
+#if !GNUSTEP
    self.canDrawConcurrently = YES;
+#endif
 
     return self;
 }
 
 - (void) dealloc
 {
+#if GNUSTEP
+   if ( _imageRep != nil )
+      [_imageRep release];
+#else
    if (_layerContext != NULL)
       CGContextRelease(_layerContext);
    if ( _imageLayer != NULL )
@@ -310,6 +324,7 @@
       _drawnTile = NULL;
       free(ary);
    }
+#endif
    if ( _item != nil )
       [_item release];
    if ( _imageTransform != nil )
@@ -500,6 +515,7 @@
 
    // Cleanup before else
    _canvasRect = NSMakeRect(0.0, 0.0, 0.0, 0.0);
+#if !GNUSTEP
    [_tilesQueue cancelAllOperations];
    [_tilesQueue waitUntilAllOperationsAreFinished];
 #warning tiles bookkeeping could be kept (but cleared) if image size does not change
@@ -520,6 +536,15 @@
       CGContextRelease(_layerContext);
       _layerContext = NULL;
    }
+#else
+   NSImage *image = nil;
+
+   if ( _imageRep != nil )
+   {
+      [_imageRep release];
+      _imageRep = nil;
+   }
+#endif
 
    // Prepare for the new image
    if ( _item != nil )
@@ -528,6 +553,7 @@
 
       if (_itemSize.width != s.width || _itemSize.height != s.height)
          _itemSize = s;
+#if !GNUSTEP
       _canvasRect = NSMakeRect(0.0, 0.0, (CGFloat)_itemSize.width, (CGFloat)_itemSize.height);
 
       if (_itemSize.width != 0 && _itemSize.height != 0)
@@ -571,6 +597,47 @@
             }
          }
       }
+#else
+      // Adjust the view frame if the image size has changed
+      if (_itemSize.width != s.width || _itemSize.height != s.height)
+         _itemSize = s;
+
+      image = [_item getNSImage];
+      if (image != nil)
+      {
+         NSRect r = {{0.0, 0.0}, {0.0, 0.0}};
+         CGFloat x, y;
+
+         r.size = [image size];
+         _imageRep = [[image bestRepresentationForRect:r context:nil hints:nil] retain];
+
+         _canvasRect = NSMakeRect(0.0, 0.0, (CGFloat)_itemSize.width, (CGFloat)_itemSize.height);
+
+         // Compute the rectangle wich encloses the transformed image (rotated, scaled)
+         for ( y = 0.0; y <= _canvasRect.size.height; y +=  _canvasRect.size.height )
+         {
+            for ( x = 0.0; x <= _canvasRect.size.width; x+= _canvasRect.size.width )
+            {
+               NSPoint p = [_imageTransform transformPoint:NSMakePoint(x, y)];
+
+               if ( p.x < _canvasRect.origin.x )
+               {
+                  _canvasRect.size.width += (_canvasRect.origin.x - p.x);
+                  _canvasRect.origin.x = p.x;
+               }
+               else if ( p.x > _canvasRect.origin.x + _canvasRect.size.width )
+                  _canvasRect.size.width = p.x - _canvasRect.origin.x;
+               if ( p.y < _canvasRect.origin.y )
+               {
+                  _canvasRect.size.height += (_canvasRect.origin.y - p.y);
+                  _canvasRect.origin.y = p.y;
+               }
+               else if ( p.y > _canvasRect.origin.y + _canvasRect.size.height )
+                  _canvasRect.size.height = p.y - _canvasRect.origin.y;
+            }
+         }
+      }
+#endif
 
       validRange = [_item isProcessed]
                    && [_item getMinLevel:&vmin maxLevel:&vmax];
@@ -606,6 +673,9 @@
    }
 
    [self applyZoom:_zoom from:nil withRedraw:YES];
+#if GNUSTEP
+   [[self window] invalidateCursorRectsForView:self];
+#endif
 }
 
 - (void) resetBounds
@@ -622,7 +692,11 @@
 {
    NSGraphicsContext *g = [NSGraphicsContext currentContext];
 
+#if !GNUSTEP
    if ( _imageLayer != NULL )
+#else
+   if ( _imageRep != nil )
+#endif
    {
       if ([_item supportsTiling])
       {
@@ -674,7 +748,9 @@
                         if (intersects)
                         {
                            // The tile with this bottom left corner is inside the draw rect
+#if !GNUSTEP
                            [self applyTileAt:CGPointMake(x,y)];
+#endif
                         }
                      }
                   }
@@ -682,6 +758,7 @@
             }
          }
       }
+#if !GNUSTEP
       else if (__sync_bool_compare_and_swap(&_drawnTile[0], Blank, Drawing))
       {
          CGRect r = {{0.0, 0.0}, {(CGFloat)_itemSize.width, (CGFloat)_itemSize.height}};
@@ -698,11 +775,16 @@
          while (_drawnTile[0] != Available)
             sched_yield();
       }
+#endif
       NSRect r = NSMakeRect(0.0, 0.0, _itemSize.width, _itemSize.height);
       [g saveGraphicsState];
       if ( _imageTransform != nil )
          [_imageTransform concat];
+#if !GNUSTEP
       CGContextDrawLayerInRect(g.CGContext, r, _imageLayer);
+#else
+      [_imageRep drawInRect:r];
+#endif
       [g restoreGraphicsState];
    }
 
--- lynkeos.app.orig/application/Sources/MyTiff16Reader.m
+++ lynkeos.app/application/Sources/MyTiff16Reader.m
@@ -202,10 +202,14 @@
          tmax[i] = _max;
          tgamma[i] = 1.0;
       }
+#if !GNUSTEP
       CGImageRef img = [buf getImageInRect:LynkeosMakeIntegerRect(0, 0, _width, _height)
                                  withBlack:tmin white:tmax gamma:tgamma];
       bitmap = [[[NSBitmapImageRep alloc] initWithCGImage: img] autorelease];
       CGImageRelease(img);
+#else
+      bitmap = [buf getNSImageWithBlack:tmin white:tmax gamma:tgamma];
+#endif
    }
 
    TIFFClose( tiff );
--- lynkeos.app.orig/application/ThreadConnectionSources/LynkeosThreadConnection.m
+++ lynkeos.app/application/ThreadConnectionSources/LynkeosThreadConnection.m
@@ -50,7 +50,10 @@
 /*!
  * @abstract Connection endpoint
  */
-@interface LynkeosThreadCnxEnd : NSObject <NSPortDelegate>
+@interface LynkeosThreadCnxEnd : NSObject
+#if !GNUSTEP
+                                           <NSPortDelegate>
+#endif
 {
 @public
    NSPort           *_port;           //!< This end mach port
--- lynkeos.app.orig/application/Sources/MyGeneralPrefs.m
+++ lynkeos.app/application/Sources/MyGeneralPrefs.m
@@ -49,7 +49,11 @@
 
 - (void) findSounds
 {
+#if !GNUSTEP
    NSArray *extensions = [NSSound soundUnfilteredTypes];
+#else
+   NSArray *extensions = [NSSound soundUnfilteredFileTypes];
+#endif
    NSFileManager *fileMgr = [NSFileManager defaultManager];
    NSArray *librarySearchPaths;
    NSEnumerator *searchPathEnum;
@@ -84,11 +88,15 @@
       {
          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/application/Sources/SER_RAW_Reader.m
+++ lynkeos.app/application/Sources/SER_RAW_Reader.m
@@ -20,6 +20,13 @@
 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 //
 
+#if GNUSTEP
+#include <stdint.h>
+#include <CoreFoundation/CFByteOrder.h>
+#define uint8 uint8_t
+#define uint16 uint16_t
+#endif /* GNUSTEP */
+
 #include <LynkeosCore/LynkeosProcessing.h>
 #include <LynkeosCore/LynkeosMetadata.h>
 #include <LynkeosCore/LynkeosInterpolator.h>
@@ -171,6 +178,7 @@
       _bytesPerRow = _width * _bytesPerPixel;
 
       // Retrieve metadata
+#if !GNUSTEP
       if (strnlen(ser.Observer, SER_STRING_LENGTH) != 0)
          [_metadata setObject:[NSArray arrayWithObject:
                                           [NSString stringWithCString:ser.Observer
@@ -186,6 +194,7 @@
          [_metadata setObject:[NSDate dateWithTimeIntervalSinceReferenceDate:
                                   (NSTimeInterval)(ser.DateTime_UTC - SER_DATE_ORIGIN)*SER_DATE_TIMEBASE]
                        forKey:LynkeosMD_CaptureDate()];
+#endif
    }
 
    return( self );
--- lynkeos.app.orig/application/Sources/geometry.h
+++ lynkeos.app/application/Sources/geometry.h
@@ -28,7 +28,12 @@
 #ifndef geometry_h
 #define geometry_h
 
+#if !GNUSTEP
 #include <CoreFoundation/CoreFoundation.h>
+#else
+#include <CoreFoundation/CFCGTypes.h>
+#include <stdbool.h>
+#endif
 
 bool pointIsInsideRect(CGPoint point, CGRect rect);
 bool segmentIntersectsHorizontalSegment(CGPoint start, CGPoint end, CGFloat xStart, CGFloat xEnd, CGFloat y);
--- lynkeos.app.orig/application/Sources/BayerImageBuffer.m
+++ lynkeos.app/application/Sources/BayerImageBuffer.m
@@ -20,8 +20,6 @@
 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 //
 
-#include <objc/objc-class.h>
-
 #include <LynkeosCore/LynkeosInterpolator.h>
 
 #include "BayerImageBuffer.h"
@@ -422,6 +420,7 @@
 
 - (u_short) numberOfPlanes {return 3;}
 
+#if !GNUSTEP
 - (CGImageRef) getImageInRect:(LynkeosIntegerRect)r
                     withBlack:(double*)black white:(double*)white gamma:(double*)gamma
 {
@@ -438,6 +437,7 @@
    LynkeosIntegerRect extract = {{0,0},r.size};
    return [img getImageInRect:extract withBlack:black white:white gamma:gamma];
 }
+#endif
 
 - (void) getMinLevel:(double *)vmin maxLevel:(double *)vmax
 {
--- lynkeos.app.orig/application/Sources/BayerImageBuffer.h
+++ lynkeos.app/application/Sources/BayerImageBuffer.h
@@ -30,6 +30,11 @@
 
 #include "LynkeosImageBuffer.h"
 
+#if GNUSTEP
+#define nullable
+#define nonnull
+#endif
+
 NS_ASSUME_NONNULL_BEGIN
 
 @interface BayerImageBuffer : LynkeosImageBuffer
--- lynkeos.app.orig/application/Sources/LibRaw_Reader.m
+++ lynkeos.app/application/Sources/LibRaw_Reader.m
@@ -29,6 +29,11 @@
 #include "DcrawReaderPrefs.h"
 #include "LibRaw_Reader.h"
 
+#if GNUSTEP
+#include <stdint.h>
+#define uint16 uint16_t
+#endif
+
 typedef uint16_t uint16_vect_t __attribute__ ((vector_size (32)));
 #define uint16_vect_length (sizeof(uint16_vect_t)/sizeof(uint16_t))
 
@@ -171,6 +176,7 @@
          _scale = 256.0 / (double)libraw_data->color.maximum;
 
       // Retrieve metadata
+#if !GNUSTEP
       if (strnlen(libraw_data->other.artist, 64) != 0)
          [_metadata setObject:[NSArray arrayWithObject:
                                           [NSString stringWithCString:libraw_data->other.artist
@@ -218,6 +224,7 @@
          [_metadata setObject:[NSNumber numberWithFloat:libraw_data->other.parsed_gps.altitude]
                        forKey:LynkeosMD_Altitude()];
       }
+#endif
 
       // TODO: Keep data in cache
       libraw_close(libraw_data);
@@ -494,7 +501,7 @@
    affTr.transformStruct = transform;
    [affTr invert];
    LynkeosIntegerPoint bottomLeft = {_width - 1  , _height - 1}, topRight = {0, 0};
-   CGPoint p, tp;
+   NSPoint p, tp;
    for (p.y = y; p.y < (y + h); p.y += (h-1))
    {
       for (p.x = x; p.x < (x + w); p.x += (w-1))
--- lynkeos.app.orig/application/Sources/LynkeosAlertPanel.m
+++ lynkeos.app/application/Sources/LynkeosAlertPanel.m
@@ -29,8 +29,9 @@
 
    if (panel != nil)
    {
-      panel.alertStyle = style;
-      panel.messageText = title;
+      [panel setAlertStyle:style];
+      [panel setMessageText:title];
+#if !GNUSTEP
       [panel layout];
       NSRect r = [panel.window contentLayoutRect];
       NSText *infoText = [[[NSText alloc] initWithFrame:NSMakeRect(0.0, 0.0, r.size.width, 50.0)]
@@ -39,6 +40,9 @@
       infoText.alignment = NSTextAlignmentJustified;
       infoText.backgroundColor = NSColor.clearColor;
       panel.accessoryView = infoText;
+#else
+      [panel setInformativeText:message];
+#endif
       return [panel runModal];
    }
    else
--- lynkeos.app.orig/application/Sources/MyImageList.m
+++ lynkeos.app/application/Sources/MyImageList.m
@@ -49,6 +49,7 @@
 static NSString * const K_IMAGE_KEY =        @"stack";
 //! Key for saving the parameters
 
+#if !GNUSTEP
 static char const * const MeanKey = "MeanKey";
 
 @interface Mean_t : NSObject
@@ -76,6 +77,7 @@
 - (instancetype)initAsMean:(double)value;
 - (NSNumber*)accumulate:(NSNumber*)n;
 @end
+#endif
 
 @interface MyImageList(Private)
 - (void) connectParametersChain ;
@@ -83,6 +85,7 @@
 - (void) updateMetadata:(MyImageListItem*)item ;
 @end
 
+#if !GNUSTEP
 @implementation NSNumber (Mean)
 - (instancetype)initAsMean:(double)value;
 {
@@ -129,6 +132,7 @@
 
 - (const char *)objCType {return @encode(double);};
 @end
+#endif
 
 @implementation MyImageList(Private)
 - (void) connectParametersChain
@@ -157,6 +161,9 @@
 
 - (void) updateMetadata:(MyImageListItem*)item
 {
+#if GNUSTEP
+   return;
+#else
    NSDictionary *itemMD = [item getMetaData];
 
    for (NSString *key in itemMD)
@@ -200,6 +207,7 @@
       }
       // For all others, the first value takes precedence
    }
+#endif
 }
 
 @end
--- lynkeos.app.orig/application/Sources/SER_Writer.m
+++ lynkeos.app/application/Sources/SER_Writer.m
@@ -109,6 +109,7 @@
       .DateTime = 0,
       .DateTime_UTC = 0
    };
+#if !GNUSTEP
    if (metaData != nil)
    {
       NSString *str;
@@ -135,6 +136,7 @@
                         + SER_DATE_ORIGIN;
       }
    }
+#endif
 
    if (SER_write_header(file, hdr) < 0)
    {
--- lynkeos.app.orig/application/Sources/FITSRawReader.m
+++ lynkeos.app/application/Sources/FITSRawReader.m
@@ -252,10 +252,17 @@
                                                withTransform:[[NSAffineTransform transform] transformStruct]
                                                  withOffsets:nullOffsets];
       
+#if !GNUSTEP
    return [[[NSImage alloc] initWithCGImage:[limg getImageInRect:LynkeosMakeIntegerRect(0, 0, _width, _height)
                                                        withBlack:vmin white:vmax gamma:g]
                                        size:NSZeroSize]
                autorelease];
+#else
+   return [[[NSImage alloc] initWithData:[[limg getNSImageWithBlack:vmin
+                                                              white:vmax
+                                                              gamma:g]
+                                           TIFFRepresentation]] autorelease];
+#endif
 }
 
 - (void) setMode:(ListMode_t)mode { _mode = mode; }
--- lynkeos.app.orig/application/Sources/MyImageListWindowOutlineView.m
+++ lynkeos.app/application/Sources/MyImageListWindowOutlineView.m
@@ -65,7 +65,7 @@
                                                      userInfo:dict];
 }
 
-- (id) outlineView:(NSOutlineView *)outlineView child:(int)index 
+- (id) outlineView:(NSOutlineView *)outlineView child:(NSInteger)index
             ofItem:(id)item
 {
    if ( _dataMode == ListData )