Skip to content

Conversation

Copy link

Copilot AI commented Nov 14, 2025

Adds a standard pkg-config file to simplify library discovery and linking for downstream projects.

Changes

  • zoslib.pc.in: Template with standard metadata (name, version, libs, cflags) and customizable placeholders
    • Default Cflags include: -DZOSLIB_OVERRIDE_CLIB=1 -DZOSLIB_OVERRIDE_CLIB_GETENV=1 -DZOSLIB_OVERRIDE_CLIB_LOCALE_FORCE
    • Default Libs include: -lzoslib and ${libdir}/celquopt.s.o
    • Placeholders for @ZOSLIB_EXTRA_CFLAGS@, @ZOSLIB_EXTRA_LIBS@, and @ZOSLIB_PRIVATE_LIBS@
  • CMakeLists.txt:
    • Add VERSION 4.0.0 to project() declaration
    • Configure and install pkgconfig file to lib/pkgconfig/
    • Support for ZOSLIB_EXTRA_CFLAGS, ZOSLIB_EXTRA_LIBS, and ZOSLIB_PRIVATE_LIBS CMake variables
  • README.md: Document pkg-config usage in Quick Start examples and list default flags

Usage

After installation, projects can now use:

# Instead of manual paths
clang++ -fzos-le-char-mode=ascii -I path/to/include -L path/to/lib -lzoslib app.cc

# Use pkg-config (automatically includes CLIB override flags and celquopt.s.o)
clang++ -fzos-le-char-mode=ascii $(pkg-config --cflags --libs zoslib) app.cc

The pkg-config file respects CMAKE_INSTALL_PREFIX and provides standard --cflags, --libs, and --modversion queries.

Customization

Users can add extra flags and libraries via CMake variables:

cmake -DZOSLIB_EXTRA_CFLAGS=" -DSOME_DEFINE" -DZOSLIB_EXTRA_LIBS=" -lpthread" ..
Original prompt

can you create a pkgconfig file for this project ?


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add pkgconfig file for project Add pkg-config support for zoslib Nov 14, 2025
Copilot AI requested a review from sachintu47 November 14, 2025 10:50
@sachintu47
Copy link
Collaborator

@copilot can we have placeholder within the zoslib.pc.in to replace extra flags and libs

Copy link
Author

Copilot AI commented Nov 14, 2025

@copilot can we have placeholder within the zoslib.pc.in to replace extra flags and libs

Added placeholders for extra flags and libs in commit eee0b89. The pkgconfig file now supports:

  • ZOSLIB_EXTRA_CFLAGS for additional compile flags
  • ZOSLIB_EXTRA_LIBS for additional public libraries
  • ZOSLIB_PRIVATE_LIBS for private libraries (static linking)

These can be set via CMake variables:

cmake -DZOSLIB_EXTRA_CFLAGS=" -DDEFINE" -DZOSLIB_EXTRA_LIBS=" -lpthread" ..

@sachintu47
Copy link
Collaborator

@copilot can this placeholder params be passed via argument

Copy link
Author

Copilot AI commented Nov 14, 2025

@copilot can this placeholder params be passed via argument

Yes, these parameters can already be passed as command-line arguments using CMake's -D flag syntax:

Direct cmake command:

cmake .. -DZOSLIB_EXTRA_CFLAGS=" -DSOME_FLAG" -DZOSLIB_EXTRA_LIBS=" -lpthread"

Via environment variables (alternative):

export ZOSLIB_EXTRA_CFLAGS=" -DSOME_FLAG"
cmake ..

With build.sh script:
Since build.sh invokes cmake, you can pass additional CMake arguments through environment variables or by modifying the cmake invocation on line 68. For example:

EXTRA_CMAKE_ARGS="-DZOSLIB_EXTRA_CFLAGS=' -DSOME_FLAG'" ./build.sh -r

Would you like me to update build.sh to accept these as explicit command-line flags (e.g., ./build.sh --extra-cflags "...") for easier use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants