Skip to content

Commit

Permalink
More native integration for applications ... install a symlink into T…
Browse files Browse the repository at this point in the history
…ools to start them up very fast, shortcutting the *step emulation layer

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@24828 72102866-910b-0410-8b05-ffd578937521
  • Loading branch information
nicola committed Mar 8, 2007
1 parent b430266 commit 7a45560
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 3 deletions.
22 changes: 22 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
2007-03-08 Nicola Pero <[email protected]>

You can now start up applications on the command line by just
using their name. Eg, 'Gorm'. To support this, we install a
wrapper in the tools directory (which is in your PATH).
* app-wrapper.template: New file.
* GNUmakefile.in (install): Install app-wrapper.template.
(uninstall): Uninstall it.
* Instance/application.make ($(GNUSTEP_TOOLS),
internal-install-app-wrapper, internal-uninstall-app-wrapper): New
rules that install/uninstall app-wrapper.template into
GNUSTEP_TOOLS with the name of the application. If symlinks are
available, don't install a wrapper script but symlink directly the
binary for maximum speed ('Gorm' will be much faster than 'openapp
Gorm' in this situation).
(internal-app-install_): Depend on internal-install-app-wrapper.
(internal-app-uninstall_): Depend on
internal-uninstall-app-wrapper.

* Instance/application.make ($(APP_DIR)/$(GNUSTEP_INSTANCE)):
Added missing CHOWN command.

2007-03-08 Nicola Pero <[email protected]>

* GNUstep.csh.in: Fixed typo when setting up PATH (Reported by
Expand Down
2 changes: 2 additions & 0 deletions GNUmakefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ install: generated-files
$(INSTALL_DATA) $(srcdir)/Instance/Documentation/$$f \
$(makedir)/Instance/Documentation; \
done; \
$(INSTALL_DATA) app-wrapper.template $(makedir); \
$(INSTALL_DATA) executable.template $(makedir); \
$(INSTALL_DATA) config-noarch.make $(makedir); \
$(INSTALL_DATA) config.make $(makedir)/$(GNUSTEP_TARGET_LDIR))
Expand Down Expand Up @@ -218,6 +219,7 @@ uninstall:
rm -f $(makedir)/Instance/Documentation/$$f; \
done
rm -f $(makedir)/executable.template
rm -f $(makedir)/app-wrapper.template
rm -f $(GNUSTEP_SYSTEM_ROOT)/share/config.site
rm -f $(makedir)/config-noarch.make
rm -f $(makedir)/$(GNUSTEP_TARGET_LDIR)/config.make
Expand Down
65 changes: 62 additions & 3 deletions Instance/application.make
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ $(APP_DIR)/$(GNUSTEP_INSTANCE):
$(ECHO_NOTHING)cp $(GNUSTEP_MAKEFILES)/executable.template \
$(APP_DIR)/$(GNUSTEP_INSTANCE); \
chmod a+x $(APP_DIR)/$(GNUSTEP_INSTANCE)$(END_ECHO)
ifneq ($(CHOWN_TO),)
$(ECHO_CHOWNING)$(CHOWN) $(CHOWN_TO) $(APP_DIR)/$(GNUSTEP_INSTANCE)$(END_ECHO)
endif
else
internal-application-build-template:

Expand Down Expand Up @@ -287,16 +290,72 @@ $(APP_DIR)/Resources/$(GNUSTEP_INSTANCE).desktop: \

internal-app-copy_into_dir:: shared-instance-bundle-copy_into_dir

#
# install/uninstall targets

#
$(APP_INSTALL_DIR):
$(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO)

internal-app-install_:: shared-instance-bundle-install
internal-app-install_:: shared-instance-bundle-install internal-install-app-wrapper
ifeq ($(strip),yes)
$(ECHO_STRIPPING)$(STRIP) $(APP_INSTALL_DIR)/$(APP_FILE_NAME)$(END_ECHO)
endif

internal-app-uninstall_:: shared-instance-bundle-uninstall
internal-app-uninstall_:: shared-instance-bundle-uninstall internal-uninstall-app-wrapper

#
# Normally, to start up an application from the command-line you would
# need to use something like 'openapp Gorm.app'. To make this easier
# for end-users, we create a 'Gorm' executable inside GNUSTEP_TOOLS
# that does just that. Your environment needs to be setup (PATH and
# library path properly setup) to use this executable. But that's OK;
# if your environment is not setup, then GNUSTEP_TOOLS wouldn't be
# in your PATH and so typing 'openapp' or 'Gorm' at the command-line
# would do nothing anyway because they wouldn't be found! ;-)
#
# If your environment is difficult (and you can't fix it), then you
# should stick with 'openapp', and you may need to specify the whole
# PATH to openapp so that it is found. Eg,
# /usr/GNUstep/System/Tools/openapp Gorm.app. That will do a full
# GNUstep environment setup and should work no matter what.
#
# If we have symlinks, we simply create a symlink from
# GNUSTEP_TOOLS/GNUSTEP_TARGET_LDIR to APP_INSTALL_DIR/APP_FILE_NAME.
# This is the fastest way to start up your application; it just jumps
# to the executable file. In fact, it is much faster than openapp.
#
# If we don't have symlinks, we install an app-wrapper consisting of a
# one-liner shell script that will start openapp. This will be
# slower.
#
# These are the rules to create/delete this 'wrapper'.
#
$(GNUSTEP_TOOLS)/$(GNUSTEP_TARGET_LDIR):
$(ECHO_CREATING)$(MKINSTALLDIRS) $@$(END_ECHO)

ifeq ($(HAS_LN_S), yes)
# We generate a relative symlink. This makes it easier to use DESTDIR
# and other packaging relocation tricks.
internal-install-app-wrapper: $(GNUSTEP_TOOLS)/$(GNUSTEP_TARGET_LDIR)
$(ECHO_NOTHING)\
cd $(GNUSTEP_TOOLS)/$(GNUSTEP_TARGET_LDIR); \
$(RM_LN_S) $(GNUSTEP_INSTANCE); \
$(LN_S) `$(REL_PATH_SCRIPT) $(GNUSTEP_TOOLS)/$(GNUSTEP_TARGET_LDIR) $(APP_INSTALL_DIR)/$(APP_FILE_NAME)` \
$(GNUSTEP_INSTANCE)$(END_ECHO)
else
# Not sure that we can use relative paths with 'exec' in a portable
# way. We want the stuff to work with DESTDIR, so in this case we use
# openapp in the app wrapper. Much slower, but should work fine.
internal-install-app-wrapper: $(GNUSTEP_TOOLS)/$(GNUSTEP_TARGET_LDIR)
$(ECHO_NOTHING)cat $(GNUSTEP_MAKEFILES)/app-wrapper.template \
| sed -e "s@GNUSTEP_INSTANCE@$(GNUSTEP_INSTANCE)@" > $(GNUSTEP_TOOLS)/$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE); \
chmod a+x $(GNUSTEP_TOOLS)/$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE)$(END_ECHO)
ifneq ($(CHOWN_TO),)
$(ECHO_CHOWNING)$(CHOWN) $(CHOWN_TO) $(GNUSTEP_TOOLS)/$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE)$(END_ECHO)
endif
endif

internal-uninstall-app-wrapper:
$(ECHO_NOTHING)$(RM) -f $(GNUSTEP_TOOLS)/$(GNUSTEP_TARGET_LDIR)/$(GNUSTEP_INSTANCE)$(END_ECHO)

include $(GNUSTEP_MAKEFILES)/Instance/Shared/strings.make
2 changes: 2 additions & 0 deletions app-wrapper.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#! /bin/sh
exec openapp "GNUSTEP_INSTANCE" "$@"

0 comments on commit 7a45560

Please sign in to comment.