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
|
Description: Fix FTBFS with gnustep-make in strict v2 mode.
Also adapt the app to the removal of the 1.x compatibility mode: some
variables are obsolete and are no longer defined while normally
nothing is exported in the environment.
Debian-Bug: https://bugs.debian.org/897620
Author: Yavor Doganov <yavor@gnu.org>
Forwarded: no
Last-Update: 2018-05-10
---
--- wrapperfactory.app.orig/GNUmakefile
+++ wrapperfactory.app/GNUmakefile
@@ -19,15 +19,9 @@
include $(GNUSTEP_MAKEFILES)/common.make
-include Directories.make
-
-GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
-
PACKAGE_NAME=GNUstepWrapper
include Version
-GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_SYSTEM_ROOT)
-
#$(GNUSTEP_TARGET_CPU)/$(GNUSTEP_TARGET_OS)/$(LIBRARY_COMBO)/GSWrapper_Launcher
SUBPROJECTS = libGSWrapper Launcher WrapperFactory
--- wrapperfactory.app.orig/Launcher/GNUmakefile
+++ wrapperfactory.app/Launcher/GNUmakefile
@@ -19,23 +19,19 @@
include $(GNUSTEP_MAKEFILES)/common.make
-include ../Directories.make
-
-GNUSTEP_INSTALLATION_DIR=$(GNUSTEP_SYSTEM_ROOT)
-
-OBJC_PROGRAM_NAME=GSWrapper_Launcher
+TOOL_NAME=GSWrapper_Launcher
GSWrapper_Launcher_OBJC_FILES=main.m
-GSWrapper_Launcher_OBJC_LIBS += -lGSWrapper -lgnustep-base -lgnustep-gui
+GSWrapper_Launcher_TOOL_LIBS += -lGSWrapper -lgnustep-base -lgnustep-gui
GSWrapper_Launcher_INCLUDE_DIRS += -I../libGSWrapper
-GSWrapper_Launcher_LIB_DIRS += -L../libGSWrapper/$(OBJ_DIR)
+GSWrapper_Launcher_LIB_DIRS += -L../libGSWrapper/obj
-GSWrapper_Launcher_COPY_INTO_LOCAL_BUNDLE = ../$(APP_DIR)/Resources/$(ARCH_DIR)
+GSWrapper_Launcher_COPY_INTO_DIR = \
+ ../WrapperFactory/WrapperFactory.app/Resources
-include GNUmakefile.preamble
ifeq ($(GSWrapper_Development),yes)
include ../GNUmakefile.development
endif
-include $(GNUSTEP_MAKEFILES)/objc.make
--include GNUmakefile.postamble
+include $(GNUSTEP_MAKEFILES)/tool.make
--- wrapperfactory.app.orig/WrapperFactory/GNUmakefile
+++ wrapperfactory.app/WrapperFactory/GNUmakefile
@@ -19,8 +19,6 @@
include $(GNUSTEP_MAKEFILES)/common.make
-include ../Directories.make
-
APP_NAME=WrapperFactory
WrapperFactory_OBJC_FILES = main.m \
@@ -50,7 +48,6 @@
include ../GNUmakefile.development
endif
include $(GNUSTEP_MAKEFILES)/application.make
--include GNUmakefile.postamble
ifeq ($(GSWrapper_Development),yes)
include GNUmakefile.development.post
endif
--- wrapperfactory.app.orig/libGSWrapper/GNUmakefile
+++ wrapperfactory.app/libGSWrapper/GNUmakefile
@@ -19,9 +19,6 @@
include $(GNUSTEP_MAKEFILES)/common.make
-
-GNUSTEP_INSTALLATION_DIR=$(GNUSTEP_SYSTEM_ROOT)
-
LIBRARY_NAME=libGSWrapper
libGSWrapper_OBJC_FILES = WrapperDelegate.m \
--- wrapperfactory.app.orig/WrapperFactory/ServicesProvider.m
+++ wrapperfactory.app/WrapperFactory/ServicesProvider.m
@@ -35,12 +35,13 @@
userData: (NSString *)userData
error: (NSString **)error
{
+ NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
NSDocumentController *documentController = [NSDocumentController sharedDocumentController];
NSArray *files = [pboard propertyListForType: NSFilenamesPboardType];
NSString *file;
NSString *appName;
WrapperDocument *doc;
- NSString *userRoot = [[[NSProcessInfo processInfo] environment] objectForKey: @"GNUSTEP_USER_ROOT"];
+ NSString *userRoot = [defs objectForKey: @"GNUSTEP_USER_DIR_APPS"];
int i;
int count = [files count];
BOOL shouldCreate = [documentController shouldCreateUI];
@@ -56,8 +57,8 @@
appName = [NSString stringWithFormat: @"%@.app", [file lastPathComponent]];
[doc setName: appName];
appName = [NSString pathWithComponents: [NSArray arrayWithObjects:
+ NSHomeDirectory(),
userRoot,
- @"Applications",
appName,
nil]];
--- wrapperfactory.app.orig/WrapperFactory/WrapperDocument.m
+++ wrapperfactory.app/WrapperFactory/WrapperDocument.m
@@ -80,6 +80,39 @@
@end
+/* Obtain a variable's value with gnustep-config. Assumes that
+ * gnustep-config is in PATH which should be the case for all
+ * installations. */
+static NSString *
+getVar(NSString *var)
+{
+ NSPipe *pipe = [NSPipe pipe];
+ NSFileHandle *handle = [pipe fileHandleForReading];
+ NSTask *task = [NSTask new];
+ NSString *output, *value;
+
+ [task setLaunchPath: @"gnustep-config"];
+ [task setArguments: [NSArray arrayWithObjects:
+ [NSString stringWithFormat: @"--variable=%@",
+ var], nil]];
+ [task setStandardOutput: pipe];
+ [task launch];
+ output = [[NSString alloc] initWithData: [handle readDataToEndOfFile]
+ encoding: NSUTF8StringEncoding];
+ value = [output stringByTrimmingCharactersInSet:
+ [NSCharacterSet newlineCharacterSet]];
+ [handle closeFile];
+
+ if ( [value isEqualToString: @""] || [task terminationStatus] != 0 )
+ [NSException raise: NSParseErrorException
+ format: @"Could not obtain the %@ variable", var];
+
+ RELEASE(task);
+ RELEASE(output);
+
+ return value;
+}
+
@implementation AppFileWrapper
- (void)dealloc
@@ -824,17 +857,19 @@
- (NSFileWrapper *)saveWrapper
{
-
- NSString *flattenedString = [[[NSProcessInfo processInfo] environment] objectForKey: @"GNUSTEP_FLATTENED"];
+ /* Try to obtain GNUSTEP_IS_FLATTENED from the environment, in
+ * case GNUSTEP_SH_EXPORT_ALL_VARIABLES is defined. Resort to the
+ * slower method if it's not exported. */
+ NSString *flattenedString = [[[NSProcessInfo processInfo] environment] objectForKey: @"GNUSTEP_IS_FLATTENED"];
BOOL flattened;
if ( flattenedString == nil ) {
- NSLog(@"GNUSTEP_FLATTENED not set");
- flattened = NO;
- }
- else {
- flattened = [flattenedString isEqualToString: @"yes"];
+ flattenedString = getVar(@"GNUSTEP_IS_FLATTENED");
+ if ( [flattenedString isEqualToString: @""] )
+ NSLog(@"GNUSTEP_IS_FLATTENED not set");
}
+ flattened = [flattenedString isEqualToString: @"yes"];
+
//NSSize iconSize = NSMakeSize(48, 48);
NSData *data;
NSDictionary *dict;
@@ -954,6 +989,13 @@
[environment objectForKey: @"LIBRARY_COMBO"],
nil];
+ if ( [exePathComponents count] < 3 )
+ exePathComponents = [NSArray arrayWithObjects:
+ getVar(@"GNUSTEP_HOST_CPU"),
+ getVar(@"GNUSTEP_HOST_OS"),
+ getVar(@"LIBRARY_COMBO"),
+ nil];
+
NSData *script;
if ( flattened ) {
script = nil;
|