lcn2 / calc

C-style arbitrary precision calculator
http://www.isthe.com/chongo/tech/comp/calc/index.html
Other
346 stars 52 forks source link

[Msys2] It will always install to `/usr` regardless of whether `PREFIX` is set or not #108

Closed ghost closed 11 months ago

ghost commented 11 months ago

@lcn2 For unknown reasons, it will always install to /usr regardless of whether PREFIX is set or not. Please have a look at it. Thank you.

Originally posted by @iahung2 in https://github.com/lcn2/calc/discussions/105#discussioncomment-7184672

lcn2 commented 11 months ago

Please 🙏 run make debug and attach the resulting log file so we can better understand your situation and environment.

UPDATE 0

Meanwhile we will investigate more this evening.

ghost commented 11 months ago

debug.out.txt

ghost commented 11 months ago

@lcn2 Have you found anything wrong in the makefiles?

lcn2 commented 11 months ago

@lcn2 Have you found anything wrong in the makefiles?

We did find Makefile problems that were fixed in addressing issue #112.

In regards to where calc installs:

For non-macOS hosts, the default for installation is under /usr/bin, /usr/lib, /usr/share/calc and /usr/include/calc.

The Makefile.config contains some relevant comments:

# Where to install calc related things
#
# ${BINDIR}             where to install calc binary files
# ${LIBDIR}             where calc link library (*.a) files are installed
# ${CALC_SHAREDIR}      where to install calc help, .cal, startup, config files
# ${CALC_INCDIR}        where the calc include files are installed
#
# NOTE: The install rule prepends installation paths with ${T}, which
#       by default is empty.  If ${T} is non-empty, then installation
#       locations will be relative to the ${T} directory.
#
# NOTE: If you change LIBDIR to a non-standard location, you will need
#       to make changes to your execution environment so that executables
#       will search LIBDIR when they are resolving dynamic shared libraries.
#
#       On OS X, this means you need to export $DYLD_LIBRARY_PATH
#       to include the LIBDIR path in the value.
#
#       On Linux and BSD, this means you need to export $LD_LIBRARY_PATH
#       to include the LIBDIR path in the value.
#
#       You might be better off not changing LIBDIR in the first place.
#
# If in doubt, for non-macOS hosts set:
#
#       BINDIR= /usr/bin
#       LIBDIR= /usr/lib
#       CALC_SHAREDIR= /usr/share/calc
#       CALC_INCDIR= /usr/include/calc
#
# Or if you prefer everything under /usr/local:
#
#       BINDIR= /usr/local/bin
#       LIBDIR= /usr/local/lib
#       CALC_SHAREDIR= /usr/local/share/calc
#       CALC_INCDIR= /usr/local/include/calc
#
# However, if you are on macOS then set:
#
#       BINDIR= ${PREFIX}/bin
#       LIBDIR= ${PREFIX}/lib
#       CALC_SHAREDIR= ${PREFIX}/share/calc
#       CALC_INCDIR= ${PREFIX}/include/calc
#
#       NOTE: Starting with macOS El Capitan OS X 10.11, root by default
#             could not mkdir under system locations, so macOS must now
#             use the ${PREFIX} tree.
lcn2 commented 11 months ago

As we do not know when or where your source was obtained, here is how you can be sure that you can uninstall calc fro the default locations:

make uninstall BINDIR=/usr/bin LIBDIR=/usr/lib CALC_SHAREDIR=/usr/share/calc CALC_INCDIR=/usr/include/calc

Here is how you can force calc to install under /usr/local:

make clobber all install BINDIR=/usr/local/bin LIBDIR=/usr/local/lib CALC_SHAREDIR=/usr/local/share/calc CALC_INCDIR=/usr/local/include/calc

Of course, you will need the appropriate permissions on those directories to uninstall and install.

lcn2 commented 11 months ago

With commit b54f68a797491be91f8671ae69c3291aeec74e09 we added comments to Makefile.local about how you can force calc to install under /usr/local, regardless of the system.

In particular, if you add these lines to Makefile.local (or uncomment the recently added lines):

BINDIR:= /usr/local/bin
LIBDIR:= /usr/local/lib
CALC_SHAREDIR:= /usr/local/share/calc
CALC_INCDIR:= /usr/local/include/calc

You will get what you want "by default" without having to add the above mentioned 4 args to your make commands.

lcn2 commented 11 months ago

So alas, this is not a bug, but a feature as they say.

We hope the above will help.

As an added bonus. we have added a TODO for calc version 3 to "improve how someone can control where calc installs things". See the TODO list in issue #103.

We will now close this issue, but feel free to add comments or questions to this issue if you are still having problems with where calc installs things.

lcn2 commented 11 months ago

See also comment discussion #105 7197014.

Sorry, @iahung2 for the confusion!