Commit 87b94c22 authored by Yves Combe's avatar Yves Combe

clean ObjC code using standard openstep functions.

svn path=/trunk/; revision=2547
parent fc8a7cd0
2007-03-25 Yves Combe <yves@ycombe.net>
clean ObjC code using standard openstep functions.
* Makefile.am:
* configure.in:
* src/gcompris/gcompris-nsbundle.m:
2007-03-24 Yves Combe <yves@ycombe.net>
Add icons and Info.plist. Tested with GNUstep.
......
......@@ -118,44 +118,44 @@ ICON=gcompris.svg
nsbundle:
$(INSTALL) -d $(BUNDLE_RESOURCES_DIR)
$(INSTALL) -d $(BUNDLE_EXEC_DIR)
$(INSTALL) -d $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)
$(INSTALL) -d $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)
make install prefix=$(BUNDLE_RESOURCES_DIR) \
exec_prefix=$(BUNDLE_RESOURCES_DIR) \
bindir=$(BUNDLE_EXEC_DIR) \
PYTHON_PLUGIN_DIR=$(BUNDLE_RESOURCES_DIR)/share/gcompris/python
mv $(BUNDLE_EXEC_DIR)/gcompris $(BUNDLE_EXEC_DIR)/$(BUNDLE_NAME)
$(INSTALL) -d $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/lib
$(INSTALL) -d $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/lib
if OS_MACOSX
for f in $$(otool -L $(BUNDLE_EXEC_DIR)/$(BUNDLE_NAME) | grep $(prefix) | sed -e 's,^.*$(prefix)/\(.*.dylib\).*$$,\1,' ); do \
ls -L $(prefix)/$$f; \
cp -Lv $(prefix)/$$f $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$$f ;\
install_name_tool -change $(prefix)/$$f @executable_path/$(NSBUNDLE_GTK_DIR)/$$f $(BUNDLE_EXEC_DIR)/$(BUNDLE_NAME) ; \
cp -Lv $(prefix)/$$f $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$$f ;\
install_name_tool -change $(prefix)/$$f @executable_path$(NSBUNDLE_GTK_DIR)/$$f $(BUNDLE_EXEC_DIR)/$(BUNDLE_NAME) ; \
done;
else
for f in $$(ldd $(BUNDLE_EXEC_DIR)/$(BUNDLE_NAME)| grep $(prefix) | sed -e 's,^.*$(prefix)/\(.*\) (.*$$,\1,' ); do \
ls -L $(prefix)/$$f; \
cp -Lv $(prefix)/$$f $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$$f ;\
cp -Lv $(prefix)/$$f $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$$f ;\
done
endif
$(INSTALL) -d $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$(ETC_GTK)
#sed -e 's,$(prefix),@{prefix},g' $(prefix)/$(ETC_PANGO)/pangorc > $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$(ETC_PANGO)/pangord
$(INSTALL) -d $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(ETC_GTK)
#sed -e 's,$(prefix),@{prefix},g' $(prefix)/$(ETC_PANGO)/pangorc > $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(ETC_PANGO)/pangord
for f in $(GTK_CONF_FILES); do\
sed -e 's,$(prefix),@{prefix},g' $(prefix)/$(ETC_GTK)/$$f > $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$(ETC_GTK)/$$f ;\
sed -e 's,$(prefix),@{prefix},g' $(prefix)/$(ETC_GTK)/$$f > $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(ETC_GTK)/$$f ;\
done
$(INSTALL) -d $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$(ETC_PANGO)
$(INSTALL) -d $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(ETC_PANGO)
for f in $(PANGO_CONF_FILES); do\
sed -e 's,$(prefix),@{prefix},g' $(prefix)/$(ETC_PANGO)/$$f > $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$(ETC_PANGO)/$$f ;\
sed -e 's,$(prefix),@{prefix},g' $(prefix)/$(ETC_PANGO)/$$f > $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(ETC_PANGO)/$$f ;\
done
$(INSTALL) $(top_srcdir)/macosx/pangorc $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$(ETC_PANGO)/pangorc
$(INSTALL) -d $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$(FONTCONFIG_PATH)
(cd $(prefix)/$(FONTCONFIG_PATH) ; tar cf - * )| ( cd $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$(FONTCONFIG_PATH); tar xf -)
cp -vf macosx/fonts.conf $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$(FONTCONFIG_PATH)
$(INSTALL) -d $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$(GTK_MODULES_PATH)
$(INSTALL) -d $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$(PANGO_MODULES_PATH)
$(INSTALL) -d $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$(PYTHON_MODULES_PATH_DEST)
(cd $(prefix)/$(GTK_MODULES_PATH) ; tar cf - --exclude include * )| ( cd $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$(GTK_MODULES_PATH); tar xf -)
(cd $(prefix)/$(PANGO_MODULES_PATH) ; tar cf - --exclude include * )| ( cd $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$(PANGO_MODULES_PATH); tar xf -)
(cd $(prefix)/$(PYTHON_MODULES_PATH_ORIG) ; tar cf - --exclude include * )| ( cd $(BUNDLE_EXEC_DIR)/$(NSBUNDLE_GTK_DIR)/$(PYTHON_MODULES_PATH_DEST); tar xf -)
$(INSTALL) $(top_srcdir)/macosx/pangorc $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(ETC_PANGO)/pangorc
$(INSTALL) -d $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(FONTCONFIG_PATH)
(cd $(prefix)/$(FONTCONFIG_PATH) ; tar cf - * )| ( cd $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(FONTCONFIG_PATH); tar xf -)
cp -vf macosx/fonts.conf $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(FONTCONFIG_PATH)
$(INSTALL) -d $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(GTK_MODULES_PATH)
$(INSTALL) -d $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(PANGO_MODULES_PATH)
$(INSTALL) -d $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(PYTHON_MODULES_PATH_DEST)
(cd $(prefix)/$(GTK_MODULES_PATH) ; tar cf - --exclude include * )| ( cd $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(GTK_MODULES_PATH); tar xf -)
(cd $(prefix)/$(PANGO_MODULES_PATH) ; tar cf - --exclude include * )| ( cd $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(PANGO_MODULES_PATH); tar xf -)
(cd $(prefix)/$(PYTHON_MODULES_PATH_ORIG) ; tar cf - --exclude include * )| ( cd $(BUNDLE_EXEC_DIR)$(NSBUNDLE_GTK_DIR)/$(PYTHON_MODULES_PATH_DEST); tar xf -)
$(INSTALL) -d $(BUNDLE_RESOURCES_DIR)/bin
for f in $(EXTERN_BIN); do \
cp -v $(prefix)/bin/$$f $(BUNDLE_RESOURCES_DIR)/bin/$$f; \
......
......@@ -72,7 +72,7 @@ if test "x$nsbundle" = "xyes"; then
if test "x$NSFoundation" = "x$no"; then
AC_MSG_ERROR([You need development tools to use nsbundle. Make sure XCode is installed." ])
fi
NSBUNDLE_GTK_DIR="../GTK"
NSBUNDLE_GTK_DIR="/../GTK"
NSBUNDLE_LDFLAGS="-framework Cocoa "
AC_LANG_POP([Objective C])
else
......@@ -87,7 +87,7 @@ if test "x$nsbundle" = "xyes"; then
fi
CPPFLAGS="$saved_CPPFLAGS"
OBJCFLAGS=" -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fconstant-string-class=NSConstantString -I$GNUSTEP_SYSTEM_ROOT/Library/Headers "
NSBUNDLE_GTK_DIR="GTK"
NSBUNDLE_GTK_DIR="/GTK"
NSBUNDLE_LDFLAGS="-rdynamic -fgnu-runtime -L$GNUSTEP_SYSTEM_ROOT/Library/Libraries -lgnustep-base -Wl,-rpath=\\\$\$ORIGIN/$NSBUNDLE_GTK_DIR/lib "
AC_LANG_POP([Objective C])
fi
......
......@@ -3,10 +3,6 @@
#include "config.h"
@interface NSMutableString (Perso)
- (id) stringCleanPath;
@end
void gcompris_fix_gtk_etc (void);
void set_prefix( NSString *prefix_source_dir,
......@@ -35,9 +31,8 @@ gchar *gcompris_nsbundle_resource(void)
void gcompris_fix_gtk_etc (void)
{
NSMutableString *gtk_path = [[[[NSBundle mainBundle] executablePath] mutableCopy] autorelease] ;
NSMutableString *gtk_path = [[[[[NSBundle mainBundle] executablePath] stringByDeletingLastPathComponent] mutableCopy] autorelease] ;
NSString *base_dir = @"/../";
NSString *gtk_dir = @NSBUNDLE_GTK_DIR ;
NSString *gtk_conf_dir = @"/etc/gtk-2.0";
NSString *pango_conf_dir = @"/etc/pango";
......@@ -51,9 +46,8 @@ void gcompris_fix_gtk_etc (void)
printf("NSBundle executablePath %s\n\n", [gtk_path UTF8String]);
// first is to suppress last component (executable name)
[gtk_path appendString: base_dir];
[gtk_path appendString: gtk_dir];
[gtk_path stringCleanPath];
gtk_path = [gtk_path stringByStandardizingPath];
printf("NSBundle Gtk Dir Path %s\n\n", [gtk_path UTF8String]);
......@@ -150,40 +144,3 @@ void set_prefix( NSString *prefix_source_dir,
}
@implementation NSMutableString (Perso)
// suppress '..' and component just before.
- (id) stringCleanPath
{
NSMutableArray *tmpPath;
uint index = 1;
tmpPath = [[[self pathComponents] mutableCopy] autorelease];
while (index < [tmpPath count]) {
if ([[tmpPath objectAtIndex: index] isEqualToString: @".."]) {
if ( index == 0)
return self;
else {
index--;
[tmpPath removeObjectAtIndex: index];
[tmpPath removeObjectAtIndex: index];
}
}
else
index++;
}
// this is to make +[NSString pathWithComponents:] construct
// an absolute path if necessary
if ([self isAbsolutePath] == YES)
{
[tmpPath replaceObjectAtIndex: 0 withObject: @""];
}
[self setString: [NSString pathWithComponents: tmpPath]] ;
return self;
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment