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

Replace hard-coded host$bin paths by IRAFPATH #128

Merged
merged 1 commit into from
Nov 1, 2020

Conversation

olebole
Copy link
Member

@olebole olebole commented Oct 25, 2020

The function irafpath() resolves the full path for a given IRAF file. The file is searched in the following directories:

  • host$bin(arch): system build executables and libraries

  • host$hlib: include files and shell scripts

  • iraf$bin(arch): IRAF executables and libraries

  • iraf$lib: IRAF include files and libraries (links)

While iraf$bin(arch) is created from IRAFARCH, host$bin(arch) is hardcoded by defines like #ifdef __x86_64__. This has two disadvantages: First, it fixes the architecture names in the executable, and second it requires a source change for every new arch. And it does not allow to have only arch-independent directory names, as it is used f.e. in Debian.

This patch unifies the handling architectures in irafpath(). This continues the path started with #117.

The code in question goes back to the first recorded IRAF version 2.8:

iraf/unix/os/irafpath.c

Lines 68 to 101 in 155505b

/* Look first in HBIN.
*/
strcpy (pathname, (char *)hostdir);
strcat (pathname, "bin.");
#ifdef mc68010
strcat (pathname, "mc68010");
#else
#ifdef mc68020
strcat (pathname, "mc68020");
#else
#ifdef mc68030
strcat (pathname, "mc68030");
#else
#ifdef sparc
strcat (pathname, "sparc");
#else
#ifdef i386
strcat (pathname, "i386");
#else
#ifdef vax
strcat (pathname, "vax");
#endif
#ifdef CONVEX
strcat (pathname, "convex");
#endif
#endif
#endif
#endif
#endif
#endif
strcat (pathname, "/");
strcat (pathname, fname);
if (access (pathname, 0) == 0)
return (pathname);

This makes theses paths configurable at runtime. It also allows to use IRAF
without machine specific bin dirs (like on Debian)
@olebole
Copy link
Member Author

olebole commented Oct 26, 2020

Cross-check for arch-independent directory names on Debian: all build logs

@olebole olebole merged commit 8175302 into iraf-community:master Nov 1, 2020
@olebole olebole deleted the remove-hardcoded-bindirs branch November 1, 2020 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant