public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: "Björn Raupach" <raupach@me.com>
To: Per Bothner <per@bothner.com>
Cc: "kawa@sourceware.org" <kawa@sourceware.org>
Subject: Re: symlink problems with mac os
Date: Mon, 30 Oct 2017 15:15:00 -0000	[thread overview]
Message-ID: <3B304768-07B4-4094-A757-64C5A152AA7D@me.com> (raw)
In-Reply-To: <b809abfd-1062-5290-31d0-3790a6f71705@bothner.com>



> On 23. Oct 2017, at 18:55, Per Bothner <per@bothner.com> wrote:
> 
> On 10/22/2017 11:47 PM, Björn Raupach wrote:
> 
>> Thanks for spending time on this. Like I said it is really a minor issue.
> 
> True. Regardless, I prefer a cleaner/simpler file layout that minimizes symlinks.
> If that can avoid a problem on Mac so much the better.

I found a to my understanding cleaner approach that doesn't rely on installing coreutils, python or some other dependency. Just pure bash. Credits go to Apache Maven and Apache Tomcat. I didn’t come up with this, I just looked how they did it.

Below is a modified version of the kawa bash script. Everything after the last line wasn’t touched.

#!/bin/bash
thisfile=`command -v $0`
case "$thisfile" in
  "") echo "installation error - can't find path to $0"; exit -1 ;;
  /*) ;;
  *) thisfile="$PWD/$thisfile"  ;;
esac
while [ -h "$thisfile" ]; do
  ls=`ls -ld "$thisfile"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '/.*' > /dev/null; then
    thisfile="$link"
  else
    thisfile=`dirname “$thisfile"`/"$link"
  fi
done
thisdir=`dirname "$thisfile"`
kawadir=`cd "$thisdir/.." >/dev/null; pwd`

Instead of using readlink -f they just parse the output of the ls command. To get to the kawadir directory they use cd instead of realpath. Works! 

Not a lawyer, so I am not sure if this copy&paste is some license infringement.

> 
>> Unfortunately I couldn’t make it work. Might be a misunderstanding on my part.
> 
> I forgot about this: there is a both a share/kawa/bin/kawa, and a bin/kawa
> that is a link to the latter.  That seems ugly.  The reason is so that the
> kawa script can just look for ../kawa/lib/kawa.jar, regardless of whether we:
> (1) run-in-place in the build directory,
> (2) run installed files (result of 'make install'), or
> (3) run from an unzipped kawa.zip binary distribution.
> 
> I think there are better ways to solve this "multi-mode problem" - one is
> for 'make install' to make a one-line patch to the kawa script as it is installed.
> 
> -- 
> 	--Per Bothner
> per@bothner.com   http://per.bothner.com/

      reply	other threads:[~2017-10-30 15:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-22 12:00 Björn Raupach
2017-10-22 12:54 ` Per Bothner
2017-10-22 13:05   ` Björn Raupach
2017-10-22 17:40     ` Per Bothner
2017-10-22 18:15       ` Björn Raupach
2017-10-22 18:31         ` Per Bothner
2017-10-22 22:10       ` Per Bothner
2017-10-23  6:47         ` Björn Raupach
2017-10-23 16:55           ` Per Bothner
2017-10-30 15:15             ` Björn Raupach [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3B304768-07B4-4094-A757-64C5A152AA7D@me.com \
    --to=raupach@me.com \
    --cc=kawa@sourceware.org \
    --cc=per@bothner.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).