Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making tingle portable #5

Open
stevenjm opened this issue Mar 25, 2017 · 0 comments
Open

Making tingle portable #5

stevenjm opened this issue Mar 25, 2017 · 0 comments

Comments

@stevenjm
Copy link

Hi,

I've been working on an OpenBSD driver for tingle using the new syspatch(8) utility due for release with OpenBSD 6.1.

Currently, tingle makes a few GNUish assumptions which mean that it cannot be correctly installed on a non-GNU system without patching every source file:

  1. Each executable file starts with #!/bin/bash. Were this the only issue, it could be easily addressed by changing it to #!/usr/bin/env bash.
  2. lib/tingle/common sets $PATH to /usr/sbin:/usr/bin:/sbin:/bin, meaning that systems which place bash in /usr/local/bin would not find it even with /usr/bin/env in the shebang.
  3. Both the Makefile and the tingle source itself (when determining $TINGLE_PREFIX) assume that tingle is to be installed under /usr. This is not generally a correct assumption even on GNU systems; /usr is typically reserved for package-managed files, while a sysadmin who runs make install would expect the installation to end up under /usr/local.

The first two points can be easily resolved by removing the explicit $PATH and changing each shebang to #!/usr/bin/env bash. I do not see value in overriding whatever $PATH the sysadmin has provided.

The third is trickier, since scripts need to know how to find their libraries somehow, and bash does not provide a standard library include path. I can see three options here:

  1. Provide a configure script and preprocess all of the sources during the build, which is marginally better than maintaining a separate patch for all of the sources on non-GNU platforms because it doesn't require regenerating every time the first few lines of a source file are changed.
  2. Provide a configuration file in /etc which specifies where to find the system-wide tingle installation. This may be problematic because:
    • It requires parsing that configuration file in every executable, as knowing the system-wide location is necessary to load the common library routines.
    • While both GNU and OpenBSD generally place configuration in /etc for third-party software, this is not a portable assumption in general (e.g., FreeBSD uses /usr/local/etc).
  3. Have each executable derive the location of its library from its own location ($0). This probably provides the best trade-off between portability and simplicity, but note that $0 may not always be a fully qualified path if the user did not invoke tingle using a fully qualified path. However, Darwin is the only system I am aware of where it is not, and tingle is unlikely to be used on Darwin systems.

I am happy to work on a solution and create a PR once I know what kind of solution might be accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant