How To Install cons on Ubuntu 20.04

In this tutorial we learn how to install cons on Ubuntu 20.04. cons is a Perl replacement for Make

Introduction

In this tutorial we learn how to install cons on Ubuntu 20.04.

What is cons

cons is:

Excerpted from the README file:

Cons is a system for constructing, primarily, software, but is quite different from previous software construction systems. Cons was designed from the ground up to deal easily with the construction of software spread over multiple source directories. Cons makes it easy to create build scripts that are simple, understandable and maintainable. Cons ensures that complex software is easily and accurately reproducible.

Cons uses a number of techniques to accomplish all of this. Construction scripts are just Perl scripts, making them both easy to comprehend and very flexible. Global scoping of variables is replaced with an import/export mechanism for sharing information between scripts, significantly improving the readability and maintainability of each script. Construction environments are introduced: these are Perl objects that capture the information required for controlling the build process. Multiple environments are used when different semantics are required for generating products in the build tree. Cons implements automatic dependency analysis and uses this to globally sequence the entire build. Variant builds are easily produced from a single source tree. Intelligent build subsetting is possible, when working on localized changes. Overrides can be setup to easily override build instructions without modifying any scripts. MD5 cryptographic signatures are associated with derived files, and are used to accurately determine whether a given file needs to be rebuilt.

There are three methods to install cons on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install cons Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install cons using apt-get by running the following command:

sudo apt-get -y install cons

Install cons Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install cons using apt by running the following command:

sudo apt -y install cons

Install cons Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install cons using aptitude by running the following command:

sudo aptitude -y install cons

How To Uninstall cons on Ubuntu 20.04

To uninstall only the cons package we can use the following command:

sudo apt-get remove cons

Uninstall cons And Its Dependencies

To uninstall cons and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove cons

Remove cons Configurations and Data

To remove cons configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge cons

Remove cons configuration, data, and all of its dependencies

We can use the following command to remove cons configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge cons

References

Summary

In this tutorial we learn how to install cons package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.