开发者

Where to put pre-built binaries with automake?

I am writing this question in part based on a related question on helper-scripts.

I have a C++ software system built with autotools. For a small part of its functionality, my system uses a closed-source pre-built binary: AMPL. I'm a freely-available student version of their software. Suppose the name of the AMPL binary file I call from within my C++ code is ampl-student. I run it from within my code using a system(...) call.

I would like ampl-student to be moved to /usr/bin along with the binary of my compiled C++ code when "make install" is run. Where in the Makefile.am should I add ampl-student. Should I just add it to the bin_PROGRAMS variable?

A related question is should I even put ampl-student in /usr/bin. Is there a more appropriate place for a "helper binary"?

I think this is, in general, a bad idea since distributing a pre-built binary along with the code doesn't guarantee that the binary will run on the end user's computer. But in this case, the user base is very small, and I happen to know that they are all using the same system configurations. So we are in fact using the deb package as a way to keep everyone updated of new releases of the software system.

Edit 1: I should emphasize that the question is first and foremost asking for where to specify a开发者_开发技巧mpl-student in the Makefile.am file used by autotools.


I'd install it in $(pkglibexecdir):

pkglibexec_PROGRAMS = ampl-student

# If you need to know the path in your code
AM_CPPFLAGS = -DPKGLIBEXECDIR=\"$(pkglibexecdir)\"

It's not really a user program, so this installs it somewhere out of the way. By default, this is going to be $(prefix)/libexec/$(package).


It really depends on whether you want to ship the software or it is going to be locally installed in the /usr/bin and all the users are going to access the software from there.

  1. If you are going to install it in /usr/bin and you want to put AMPL there too, define a symbolic constant to the path and use it.
    #define AMPL /usr/bin/ampl-student
    whichever source file you want to use it you can add,
    system(AMPL);
  2. If you want to ship the binary of your code, then you should put ampl-bin in the bin directory of your software or create a dir. structure as:

< your tool >/src
< your tool >/bin - you can put ampl-student also here
< your tool >/third-party/< tool1 > ....< tooln >/bin/ you can put ampl-student here

As you have rightly mentioned before distributing ampl-student make sure, it works in all platforms where the tool is supposed to run.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜