Skip to content

EdgeOfAssembly/build_analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Build Analyzer

A Python tool for analyzing build system configurations without extracting archives to disk. It identifies build requirements, options, and dependencies from Autotools, CMake, and Meson projects.

Features

  • Tar Archive Support: Analyze compressed archives directly without extracting to disk
    • Supports .tar, .tar.gz/.tgz, .tar.bz2/.tbz2, .tar.xz/.txz
    • Optional .tar.zst/.tar.zstd support with zstandard package
  • Multiple Build Systems: Detects and parses:
    • Autotools: configure.ac, configure.in, Makefile.am
    • CMake: CMakeLists.txt
    • Meson: meson.build, meson_options.txt, meson.options
  • Memory-Efficient: Streams through archives and only extracts relevant build files into memory
  • Dependency Detection: Identifies required and optional dependencies
  • Build Options: Lists available configuration options and switches
  • JSON Output: Machine-readable JSON output for integration with other tools

Requirements

Python Version

  • Python 3.6 or later

Required Dependencies

  • Python standard library modules (no external dependencies required for basic functionality):
    • argparse, json, logging, os, re, sys, tarfile, io

Optional Dependencies

Package Version Purpose
zstandard >= 0.15.0 Support for .tar.zst and .tar.zstd archives

Install optional dependencies:

pip install zstandard

Installation

No installation required. Simply download build_analyzer.py and run it with Python 3.

# Clone the repository or download the script
git clone https://github.com/EdgeOfAssembly/build_analyzer.git
cd build_analyzer

Usage

Basic Usage

# Analyze a directory
python3 build_analyzer.py /path/to/source/directory

# Analyze a tar archive (without extracting to disk!)
python3 build_analyzer.py project-1.0.tar.xz

# Output in JSON format for machine-readable output
python3 build_analyzer.py --json project-1.0.tar.xz

Examples

Analyze a compressed archive directly

# Analyze Linux kernel source without extracting 1.5GB
python3 build_analyzer.py linux-6.12.tar.xz

# Analyze GCC source archive
python3 build_analyzer.py gcc-15.2.0.tar.xz

# Analyze Mesa graphics library
python3 build_analyzer.py mesa-25.3.1.tar.xz

# Analyze graphite2 library
python3 build_analyzer.py graphite2-1.3.14.tgz

Sample Output

Analyzing tar archive: mesa-25.3.1.tar.xz
(Reading directly from archive without extracting to disk)

Meson project at mesa-25.3.1:
Meson version expected: 1.1.0
Supported options (sorted):
    gallium-drivers             array     auto          List of Gallium drivers to build
    vulkan-drivers              array     auto          List of Vulkan drivers to build
    ...
Dependencies (sorted):
    libdrm >= 2.4.109
    libunwind (optional)
    llvm >= 15.0.0
    ...

Supported Archive Formats

Extension Compression Notes
.tar None Plain tar archive
.tar.gz, .tgz gzip Built-in Python support
.tar.bz2, .tbz2 bzip2 Built-in Python support
.tar.xz, .txz xz/LZMA Built-in Python support
.tar.zst, .tar.zstd Zstandard Requires zstandard package

How It Works

  1. Archive Detection: The tool detects if the input is a tar archive based on file extension
  2. Streaming Extraction: Only build system files are extracted into memory (not to disk)
  3. Build System Detection: Identifies Autotools, CMake, and Meson projects
  4. Parsing: Extracts version requirements, build options, and dependencies
  5. Output: Displays organized information about each build system found

Extracted Files

The tool only extracts these files into memory:

  • configure.ac, configure.in (Autotools)
  • CMakeLists.txt (CMake)
  • meson.build, meson_options.txt, meson.options (Meson)
  • Makefile.am, Makefile.in (Automake version detection)

Output Information

Autotools Projects

  • Autoconf version required (from AC_PREREQ)
  • Automake version required (from AM_INIT_AUTOMAKE, AUTOMAKE_OPTIONS)
  • Configure switches (--enable-*, --disable-*, --with-*, --without-*)
  • Environment variables (from AC_ARG_VAR)
  • Dependencies (from AC_CHECK_LIB, PKG_CHECK_MODULES)

CMake Projects

  • CMake version required (from cmake_minimum_required)
  • Build options (-D variables from option() and set(... CACHE ...))
  • Dependencies (from find_package)

Meson Projects

  • Meson version required (from meson_version)
  • Build options (from option() definitions)
  • Dependencies (from dependency() calls)

License

Copyright (c) 2025 EdgeOfAssembly

This project is dual-licensed:

Open Source License (Default)

This software is licensed under the GNU General Public License v3.0 (GPLv3).

See the LICENSE file for the full license text.

Commercial License

For commercial use or if you need a license other than GPLv3, please contact the author:

EdgeOfAssembly
Email: haxbox2000@gmail.com

Contributing

Contributions are welcome! Please ensure any contributions are compatible with the GPLv3 license.

Author

EdgeOfAssemblly - haxbox2000@gmail.com

About

A Python tool for analyzing build system configurations without extracting archives to disk. It identifies build requirements, options, and dependencies from Autotools, CMake, and Meson projects.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages