A previous post covered altering the install target so that it places the .exe assembly into the filesystem of the installer’s computer. In this part, we will cover creating the so-called “wrapper” script, which is the way recommended by the mono project’s application deployment guidelines to make the assembly executable on the system outside of the source distribution.
Return to the workplace
$ cd ~/src/greeting/
Create the wrapper script template
$ cat > greeting.in
#!/bin/bash
exec @RUNTIME@ @prefix@/lib/mono/@PACKAGE_NAME@/Greeting.exe "$@"
^D
Alter the configure.ac file to process the wrapper template
$ patch configure.ac
@@ -13,6 +13,7 @@ AC_CONFIG_FILES([ Makefile +greeting ]) AC_OUTPUT
^D^D
Alter the Makefile.am file to distribute the wrapper template
$ cat >> Makefile.am
bin_SCRIPTS = greeting
^D
Re-build the Makefile and wrapper script
$ autoconf && automake && ./configure
Test the install target
$ make && sudo make install
$ which greeting
/usr/local/bin/greeting
$ greeting ––number 8
Greetings, Neptune!
Conclusion
In this post, I gave an example of creating a simple wrapper shell script and using the autotools infrastructure to locate and use the system C# compiler and CLI runtime. This may not seem like much of a feat, but many systems have their binaries installed in weird locations and other quirks. The autotools system is able to detect and take care of these details without having the maintainer of the software create system-specific tweaks that would undoubtedly reduce the number of platforms on which the software would work.