Skip to main content

ebuild

Intro

Easily cross compile your C/C++ projects or create your SDK with simple Python scripts, let forget Makefile or CMake.

Features

  • Easy to use, only a few fill-in-the-blanks based on simple template.
  • Scalable and flexible, Use Python script, easy-to-use and powerfull, real program language, not string based language like CMake.
  • Configurable, support menuconfig.

Install

Ensure you have Python installed first, then:

pip install ebuild

Execute ebuild -h to start.

First project

ebuild create hello_world
cd hello_world
ebuild  # or ebuild build
ebuild run
ebuild clean
ebuild distclean

In hello_world directory have an ebuild_config.py file like:

from ebuild import find_src

class Project:
    build_type = "binary"  # binary, shared, static
    id = "hello"
    name = "Hello"
    desc = "Simple hello program"
    home = "https://github.com/neutree/ebuild"
    license = "MIT"
    version = "1.0.0"

    def on_add_src(self, dl_dir):
        srcs = find_src(".", [".c", ".cpp"], resursive = False)
        return srcs
  • class Project means this is a project.
  • build_type = "binary" means we need to generate a executable binary file.
  • id is the unique name of this project, the final binary file name will be this.
  • name is the name of this project.
  • desc home license are description, home url, open source license.
  • version is the version of project, format must be like major.minor.patch
  • on_add_src function need we return the souce files list, so we invoke find_src to find all c/cpp file in current directory.

Cross compile

When execute ebuild, will automatically build for host(your PC) with default toolchain(e.g. gcc on Linux). If you want to cross compile, you need to assign your platform info, by default ebuild ingrated some platforms like linux/windows/macos and some special embeded platforms, you can find them by ebuild platform list, every platform has some toolchains, use ebuild toolchain platform_name to show. Then use ebuild config platform=linux toolchain=gcc, this config will save to this project's .config file, remove .config file will change back to default platform.

If you want to customize a new special platform or toolchain, edit or create .yaml file in ~/.ebuild/platforms, or commit code to ebuild.

Menuconfig

Execute ebuild menu, then you can select options in GUI mode. Press Q or ESC to exit, the config items will be saved to build/config directory, and you can use config item in source like

#include "global_config.h"

#if CONFIG_LIBNAME_XXXX
#endif

Which LIBNAME is the uppercase of library name, XXXX is uppercase config item in the library.

Add requirements

If your project want to use some library, return your requires in on_requires function like:

class Project:
    def on_requires(self):
        '''
            Returns:
                requires I need, list type.
        '''
        requires = [
            # "inifile2"
            # "inifile2 >= 1.0.0"
            # "inifile2 == 1.0.0"
            # "inifile2 <= 1.0.0"
            # "inifile2 > 1.0.0"
        ]
        return requires

Where to find libraries:

  • Official libraries repository: use int add_requires will automatically download.
  • Third party libraries contains ebuild_config.py:
    • Download manually and put in ~/.ebuild/libraries.
    • Or just return github address like ["git+https://github.com/xxx/xxx.git"], ebuild will automatically download it, ensure you have git installed and good network can connecte to github.com.

Customize a library

Write a Lib class in ebuild_config.py file, implement callbacks

class Lib:
    def on_add_include(self, dl_dir):
        return ["inc"]

    def on_add_src(self, dl_dir):
        srcs = find_src("src", [".c", ".cpp"], resursive = False)
        return srcs

Change data store path

All downloaded data will be downloaded to ~/.ebuild, you can customize this path by ebuild config data_path=/xxx/xxx/xxx

Metadata

Release files for ebuild 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ebuild 1.0.0
File Size Uploaded Provenance
ebuild-1.0.0.tar.gz 5.3 kB Without provenance Details

Release files / ebuild-1.0.0.tar.gz

Download URL ebuild-1.0.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
de1f6fc2dba2087b1169912672d67d57d1a3bbfd39263915820283775e71b4bb
BLAKE2b-256 checksum
How to use checksums
503a4da330fdbcfd592b7c3c4cf6482ffd086df1402c351d77146798244e0957
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.10.12

Security for ebuild 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page