2
votes


I'm trying to create CGI application in C++ that uses autotools build system. This application will be an interface to my embedded device.
As a result of make/make all I have bin directory with *.cgi executables, previously prepared html-templates and images directory and lighttpd configuration file.

I need to move my content to proper directories of target device, i.e.:

  • all .cgi from bin move to $(wwwdir)/cgi-bin where if not specified than wwwdir would be /var/www/
  • images directory recursively to the same $(wwwdir) directory
  • all of the html templates to $(datarootdir)/$(PACKAGE_NAME)
  • lighttpd.conf to $(sysconfdir)

List of my programs is defined like so:
bin_PROGRAMS=$(top_builddir)/bin/main.cgi (here only one main.cgi)

Is there an elegant way to specify installation steps using configure.ac/Makefile.am file so that once user (or some other build system) runs make install all files will get where they supposed to?

Currently as a result of make install- binary file main.cgi lands in /usr/local/bin/.

1

1 Answers

1
votes

Currently as a result of make install- binary file main.cgi lands in /usr/local/bin/.

Yes, that's expected. You can set this when you run configure, e.g.

./configure --prefix=/var/www ...

should install your bin_PROGRAMS to /var/www/bin.

In your case, you're going to need to set more:

./configure --prefix=/var/www --bindir=/var/www/cgi-bin --sysconfdir=/wherever

should set datarootdir to /var/www/share

Adding your HTML templates to pkgdata_DATA should put them in /var/www/sharePACKAGE. You'll probably need to add an install hook for your image files since they probably belong in pkgdata_DATA too in reality, but are not.

Add lighttpd.conf to sysconf_DATA. I think that covers all your files.