{"id":21027298,"url":"https://github.com/franko/lhelper","last_synced_at":"2026-03-04T19:02:23.108Z","repository":{"id":38539995,"uuid":"65018761","full_name":"franko/lhelper","owner":"franko","description":"A simple utility to helps compile and install C/C++ libraries on Windows and Linux","archived":false,"fork":false,"pushed_at":"2025-01-20T12:47:40.000Z","size":7509,"stargazers_count":13,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T07:43:14.718Z","etag":null,"topics":["build-tool","c","c-plus-plus","cmake","linux","meson","mingw","recipe"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/franko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-05T13:01:06.000Z","updated_at":"2025-01-20T12:47:42.000Z","dependencies_parsed_at":"2023-11-30T15:29:17.394Z","dependency_job_id":"20ed6b71-e148-40af-82c1-0241fedd0d9c","html_url":"https://github.com/franko/lhelper","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franko%2Flhelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franko%2Flhelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franko%2Flhelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/franko%2Flhelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/franko","download_url":"https://codeload.github.com/franko/lhelper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254323069,"owners_count":22051708,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-tool","c","c-plus-plus","cmake","linux","meson","mingw","recipe"],"created_at":"2024-11-19T11:49:23.238Z","updated_at":"2026-03-04T19:02:23.065Z","avatar_url":"https://github.com/franko.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Little Library Helper\n\nAn simple utility to help you compile C and C++ libraries on Linux, Windows\n(using MSYS2) and Mac OS X.\n\nLhelper read the build instruction of each package for you and know about the\nmost common build systems like makefile, cmake, configure scripts and meson.\n\nIt helps to simplify the develoment by creating separate environments each\ncontaining a collection of libraries compiled using specific a compiler and\nspecific compiler's flags.\n\nFor example an environment may be used for libraries compiled for x86\narchitecture and another one for x86-64. Some environments may use the same\nlibrary but compiled with different features or options to suit a specific task.\n\nLhelper provides a set of ready-to-use recipes with useful defaults and options.\nBy default each **library will be compiled as a static library and with minimal\noptions**. Additional options can be enabled only if explicitly requested.\n\nIf needed a library can be compiled as a shared library using the `-shared` option.\n\nBy compiling the libraries as static library lhelper helps producing smaller\nexecutables and simplifies the distribution because it minimizes the number of\nrequired shared libraries. In addition enabling only a minimal set of features\nfor each library helps to further reduce the executable's size and the dependencies\nof the application.\n\n## How to install\n\nLittle Library Helper can be installed using the command:\n\n```sh\nwget -q -O - https://raw.githubusercontent.com/franko/lhelper/master/install-github | bash -\n```\n\nOr, alternatively, by making a clone of the git repository and then using the 'install' script:\n\n```sh\ngit clone https://github.com/franko/lhelper.git\ncd lhelper\nbash install \u003cinstall-prefix-directory\u003e\n```\n\nThe `\u003cinstall-prefix-directory\u003e` can be any directory but it should contains a `bin` folder and it should be part of you PATH. The helper will install its files in the `\u003cprefix\u003e/share/lhelper` directory and it will use the directory `\u003cprefix\u003e/var/lhelper` to store downloaded archives and build the libraries.\n\nOn Linux or Mac OS X you may use the `$HOME/.local` directory as a prefix.\n\n## Usage\n\nLittle Library Helper works by creating a build environments based on a spec file, usually a\nfile with \".lhelper\" extension.\n\nThe spec file contains information about the compiler to be used, the CPU to target,\nthe kind of build and the list of packages to install.\nThe packages are develoment libraries or commands needed by your project and each of\nthem can be built and installed using specific options for your project.\n\nThe spec file is just a bash script that is sourced before creating the environment and\nshould define the following variables: `CC`, `CXX`, `CFLAGS`, `CXXFLAGS` `LDFLAGS`, `BUILD_TYPE`\nand the array variable `packages`.\nThe variables `CPU_TYPE`, `CPU_TARGET` are optional and if not set they will be set to\nmatch your current system using a conservative `CPU_TARGET` value.\n\nThe array variable `packages` defines the list of packages you want to install in the enviroment\nwith the options for each one.\n\nThe command to create an environment from a spec file is:\n\n```sh\nlhelper create \u003cspec-file\u003e [options]\n```\n\nIf the file doesn't exist yet the option `-e` can be given and lhelper will propose\nfor editing a spec file.\nIt will use the environment variables `CC`, `CXX`, `CFLAGS`, `CXXFLAGS` `LDFLAGS` to\npropose an initial spec file and will guess the CPU architecture.\nIn addition the proposed spec file will contain helpful comments about each variable\nso using the option `-e` with the \"create\" command is the recommended way to create\na new spec file.\n\nThe command will also accept the option `--show-dependencies` to show the dependencies of\neach package.\n\nA minimal spec file could be like the following:\n\n```sh\nCC=gcc\nCXX=g++\nCFLAGS=\nCXXFLAGS=\nLDFLAGS=\nCPU_TYPE=x86-64\nCPU_TARGET=nehalem\nBUILD_TYPE=Release\n\npackages=(\"libfoo -opt1\" \"libbar -opt1 -opt2\")\n```\n\nThe create command has a closely related command called \"activate\" with the same options.\n\n```sh\nlhelper activate [options] \u003cspec-file\u003e\n```\n\nThe \"activate\" command will behave like \"create\" except after the creation of the environment it\nwill \"activate\" it by starting a subshell in the new environment.\n\nTo activate an environment without starting a new sub-shell the following command can be used:\n\n```sh\nsource \"$(lhelper env-source \u003cenv-name\u003e)\"\n```\n\nto define the variables of a given environemnts in the current shell session.\n\n### Edit and reload environemnts\n\nWhen inside an environement's subshell you can use the related commands:\n\n```sh\nlhelper edit\nlhelper reload\n```\n\nThe \"edit\" command will prompt you to modify the spec file using your editor (as defined\nby the EDITOR variable) and, once modified, will restart the subshell in the modified\nenvironment.\n\nWhen restarting the subshell Lhelper will take care or remove, install or re-install each\npackage as required to match the new spec file.\n\nThe command \"reload\" will just reload the subshell in case you modified the spec file by\nyourself.\n\n### Install commands\n\nOnce inside an environment any library can be installed using a simple command:\n\n```sh\nlhelper install [--local] [--rebuild] \u003clibrary-name\u003e [library-version] [library-options]\n```\n\nHowever the spec file will not be modified so the next time you will restart the\nenvironment the packages you installed on-the-fly will not be included.\n\nTo include permanently a package modify the spec file itself by adding the new package\nin the array variable \"packages\".\n\nOtherwise the \"install\" command is useful to quickly experiment in a temporary environment\nwithout commiting any change.\n\nThe option `--local` force lhelper to look for the recipe in the current folder.\nWhen using `--local` the libray-version is required.\n\nThe option `--rebuild` force a new rebuild of the library even if a saved\npackage for the library already exists.\n\nThe library-options are used to configure the library's build and should be\ngiven after the package name. Common options are `-shared` to compile as a\nshared library and `-pic` to compile position-independent code (-fPIC flag).\n\nA library package can be removed from an environment using the command:\n\n```sh\nlhelper remove \u003clibrary-name\u003e\n```\n\nLike the install command it will not modify the spec file so any modifications will\nbe lost when reloading the environemnt.\n\n### Recipes commands\n\nThe list of the recipes can be updated using the commande\n\n```sh\nlhelper update recipes\n```\n\n### Listing commands\n\nEnvironments and recipes can be listed with the commands:\n\n```sh\nlhelper list environments\nlhelper list recipes\n```\n\nWhile the command:\n\n```sh\nlhelper list packages\n```\n\nlist all the installed libraries when inside an environment.\n\nThe files provided by a package can be listed as\n\n```sh\nlhelper list files \u003clibrary-name\u003e\n```\n\n### Environment commands\n\nAn existing environment can be deleted with the command:\n\n```sh\nlhelper delete \u003cenv-name\u003e\n```\n\n## Generalities\n\nWhen a request to install a library is made the helper will actually download\nthe source code from the internet, build the library and install it in a\npackaged form.\n\nThe package created when a library is compiled are locally stored and they are\nre-used when a new install is requested with the same options and compiler.\n\nOnce a library is installed it will be discoverable by build systems like CMake,\nconfigure, Meson or other but **only inside the environment** where it was\ninstalled.\n\nWhen you are done just type 'exit' and you will go back to the original shell to\nquit the environment.\n\n## Prerequisites\n\nThe following software should be installed and available in the PATH:\n\n- bash shell (at least version 4)\n- git\n- gcc or clang compiler\n- curl\n- tar\n\nIn addition, to be able to compile and install libraries make sure you have installed at least the following tools:\n\n- GNU Makefile (make)\n- CMakefile (cmake)\n- Ninja\n- Meson Build System\n\nIn practice Little Library Helper on Windows works well with Mingw and with\nMsys2. Msys2 provides all the applications above by installing the appropriate\npackages. If you do not use Msys2 it is up to you to ensure that they are\navailable in the PATH from the bash shell.\n\nOn Mac OS X just make sure you installed a recent version of bash and that you install the additional tools required.\nThe easy way is to use Homebrew to install all the additional tools.\n\nOn Linux just make sure that the packages that provides the commands above are installed.\n\n## How it is implemented\n\nLittle Library Helper is implemented as a few, simple, bash scripts and a simple helper tool written in C.\n\nIt doesn't need a separate compilation step as the C util will be compiled on the fly when installing,\nprovided a C compiler is available.\n\n## What about the recipes\n\nCurrently a set of recipe is available from the `lhelper-recipes` repository.\nThey are installed on your system when running the 'install' script.\n\nHere what a typical recipe looks like:\n\n```sh\nenter_git_repository magnum https://github.com/mosra/magnum.git master\nbuild_and_install cmake -DWITH_SDL2APPLICATION=ON\n```\n\nThe recipe is just a simple shell script. If needed each recipe can be easily modified and if a recipe is missing you can easily create a new one.\n\n## Limitations\n\n- no attempt is made to manage dependencies between libraries. It is left to the user to install the libraries as needed in the good order.\n- lhelper does not keep trace of the which libraries are provided by the system. When building a package some system libraries may be used but lhelper do not track them.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranko%2Flhelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffranko%2Flhelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranko%2Flhelper/lists"}