C-Menu 0.2.9
A User Interface Toolkit
Loading...
Searching...
No Matches
BUILD


Introduction

The instructions below will guide you through building and installing C-Menu from source.

Build Tool Choices

  1. GNU Makefile
  2. CMake

If you plan to develop C-Menu, use the build tool you are most comfortable with, as both are fully supported and will produce similar results.

Build Type Choices

  1. Debug (default)
  2. Release

If you are building C-Menu for development or debugging purposes, use the default Debug build type. This creates unstripped executables with debugging symbols. As of C-Menu 0.2.9, the Debug binaries are about 6.5 Mb.

If you are building C-Menu for deployment or want to optimize for size and performance, use the Release build type. As of C-Menu 0.2.9, the Release binaries are about 1.4 Mb.

Prerequisites

  • One of:
    • CMake 3.20 or higher, or
    • GNU Make 4.3 or higher
  • A C compiler that supports C23 or later (e.g., GCC 13 or later, Clang 15 or later)
  • NCursesw development libraries 6.5 or later
  • GNU GLIBC development files
  • GNU Math Library (libm) development files

Preparing

It is strongly recommended that you build C-Menu as a regular user and only use root privileges for the installation step.

Clone the C-Menu repository and change to the C-Menu/src directory.

gh repo clone BillWaller/C-Menu

Change to the C-Menu/src directory.

cd C-Menu/src

Build

GNU Makefile

CAUTION: In the CMenu build system, C-Menu/src/Makefile is a temporary file which will be overwritten by CMake. It will be used for the GNU Makefile build and the CMake build, and CMake will overwrite it. This shouldn't be a problem because the original GNU Makefile is in C-Menu/src/GNUMakefile.

What you don't want to do is spend time editing C-Menu/src/Makefile and then have CMake overwrite your changes. To avoid this, if you make changes to C-Menu/src/Makefile, copy it to C-Menu/src/GNUMakefile.XXX, where XXX is a descriptive suffix or version number.

So you don't have to type "-f GNUMakefile" with every make command, copy C-Menu/src/GNUMakefile to Makefile

cp GNUMakefile Makefile

To build the Debug version:

make

To build the Release version:

make BUILD_TYPE=Release

If you want to run the build in a separate build directory (recommended), you can use the following commands:

mkdir build
cd build
cp ../GNUMakefile Makefile
ln -sf ../include .
make VPATH=.. BUILD_TYPE=Release
sudo make install

Choosing the above method obviates the need for the install step below, as the last command completes the install.


CMake

CAUTION: In the CMenu build system, C-Menu/src/Makefile is a temporary file which will be overwritten by CMake. It will be used for the GNU Makefile build and the CMake build, and CMake will overwrite it. This shouldn't be a problem because the original GNU Makefile is in C-Menu/src/GNUMakefile.

What you don't want to do is spend time editing C-Menu/src/Makefile and then have CMake overwrite your changes. To avoid this, if you make changes to C-Menu/src/Makefile while you are building with GNU Makefile make, copy the Makefile to C-Menu/src/GNUMakefile.XXX, where XXX is a descriptive suffix or version number.

You don't need to protect the CMake Makefile because it is generated by CMake from another file, C-Menu/src/CMakeLists.txt.

To build with C-Make:

cmake .

This will generate the necessary build files for your system. By default, CMake will configure the project to build the Debug variants of the C-Menu binaries. If you want to build the Release variants, specify the build type when configuring CMake:

cmake . -DCMAKE_BUILD_TYPE=Release

You will now have a CMake makefile in C-Menu/src/Makefile. Build the project using the following command:

make

If you want to run the build in a separate build directory (recommended), you can use the following commands:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
sudo cmake --install build

Choosing the above method obviates the need for the install step below, as the last command completes the install.

Install

To install C-Menu binaries, run the following command with root privileges:

sudo make install

This will install the C-Menu binaries and libraries to the specified PREFIX directory (e.g., /home/your_user_name/menuapp) and set the appropriate permissions.

Post Install

Check the Installation

After installation, you can verify that the C-Menu binaries and libraries have been installed to the correct directories (e.g., /home/your_user_name/menuapp/lib64 and /home/your_user_name/menuapp/bin) and that the permissions are set correctly. You can do this by running the following command:

cat manifest.txt

This will display a list of all the files that were installed, along with their permissions and sizes. You should see entries for the C-Menu binaries in /home/your_user_name/menuapp/bin and the C-Menu libraries in /home/your_user_name/menuapp/lib64, as well as the configuration file for the dynamic linker in /etc/ld.so.conf.d/CMenu.conf.

-rwxrr-xr-x 1 root root 25 260613 0936 /etc/ld.so.conf.d/CMenu.conf*
lrwxrwxrwx 1 root root 22 260613 0948 /etc/pam.d/rsh-auth -> /etc/pam.d/rsh-auth-pc
-rw-r--r-- 1 root root 28 260611 1729 /etc/pam.d/rsh-auth-pc
-rwxr-xr-x 1 root root 74720 260613 0947 /home/bill/menuapp/bin/amort*
lrwxrwxrwx 1 root root 27 260613 0948 /home/bill/menuapp/bin/ckeys -> /home/bill/menuapp/bin/menu*
-rwxr-xr-x 1 root root 77576 260613 0947 /home/bill/menuapp/bin/detach*
-rwxr-xr-x 1 root root 149888 260613 0947 /home/bill/menuapp/bin/enterchr*
-rwxr-xr-x 1 root root 142728 260613 0947 /home/bill/menuapp/bin/enterstr*
lrwxrwxrwx 1 root root 27 260613 0948 /home/bill/menuapp/bin/form -> /home/bill/menuapp/bin/menu*
-rwxr-xr-x 1 root root 100576 260613 0947 /home/bill/menuapp/bin/iloan*
-rwxr-xr-x 1 root root 566224 260613 0947 /home/bill/menuapp/bin/menu*
lrwxrwxrwx 1 root root 27 260613 0948 /home/bill/menuapp/bin/pick -> /home/bill/menuapp/bin/menu*
-rws--s--x 1 root root 140248 260613 0947 /home/bill/menuapp/bin/rsh*
-rws--s--x 1 root root 149168 260613 0947 /home/bill/menuapp/bin/rsh_pam*
-rws--s--x 1 root root 3529616 260613 0947 /home/bill/menuapp/bin/rsh_static*
-rwxr-xr-x 1 root root 129520 260613 0947 /home/bill/menuapp/bin/stripansi*
lrwxrwxrwx 1 root root 27 260613 0948 /home/bill/menuapp/bin/view -> /home/bill/menuapp/bin/menu*
-rwxr-xr-x 1 root root 145280 260613 0947 /home/bill/menuapp/bin/whence*
-rwxr-xr-x 1 root root 40626 260612 1706 /home/bill/menuapp/include/cm.h*
-rwxr-xr-x 1 root root 8567 260610 1530 /home/bill/menuapp/include/common.h*
-rwxr-xr-x 1 root root 26927 260602 1412 /home/bill/menuapp/include/form.h*
-rwxr-xr-x 1 root root 12761 260601 1356 /home/bill/menuapp/include/menu.h*
-rwxr-xr-x 1 root root 4682 260613 0848 /home/bill/menuapp/include/pick.h*
-rwxr-xr-x 1 root root 10400 260610 1531 /home/bill/menuapp/include/view.h*
-rwxr-xr-x 1 root root 1131618 260613 0947 /home/bill/menuapp/lib64/libcm.a*
lrwxrwxrwx 1 root root 39 260613 0948 /home/bill/menuapp/lib64/libcm.so -> /home/bill/menuapp/lib64/libcm.so.0.2.9*
lrwxrwxrwx 1 root root 39 260613 0948 /home/bill/menuapp/lib64/libcm.so.0 -> /home/bill/menuapp/lib64/libcm.so.0.2.9*
-rwxr-xr-x 1 root root 347880 260613 0947 /home/bill/menuapp/lib64/libcm.so.0.2.9*
-rwxr-xr-x 1 bill bill 6598 260604 1548 /home/bill/menuapp/man/man1/cmenu.1.gz*
-rwxr-xr-x 1 bill bill 3416 260604 1548 /home/bill/menuapp/man/man1/lf.1.gz*
-rwxr-xr-x 1 bill bill 3027 260604 1548 /home/bill/menuapp/man/man1/rsh.1.gz*

C-Menu Libraries

The C-Menu build system installs C-Menu libraries in:

$HOME/menuapp/lib64

To run the C-Menu binaries, you need to ensure that the dynamic linker can find the C-Menu libraries. The build system installs a configuration file for the dynamic linker in:

/etc/ld.so.conf.d/CMenu.conf

The contents of CMenu.conf should include the path to the C-Menu libraries, which is:

/home/your_user_name/menuapp/lib64

C-Menu Binaries

The C-Menu binaries are installed in:

$HOME/menuapp/bin

Set Up Your Environment

Put the following lines in your shell profile (e.g., ~/.bashrc, ~/.zshrc) to set up your environment for running C-Menu binaries:

export PATH="$HOME/menuapp/bin:$PATH"
export LD_LIBRARY_PATH="$HOME/menuapp/lib64:$LD_LIBRARY_PATH"
export CMENU_HOME="$HOME"/menuapp

Running C-Menu

After setting up your environment, you can run the C-Menu binaries from any terminal. For example, to run the menu binary, simply type:

menu

Conclusion

You have successfully built and installed C-Menu from source. You can now use the C-Menu binaries and libraries in your projects or run the C-Menu applications as needed. If you encounter any issues during the build or installation process, please refer to the documentation or seek help from the C-Menu community.