Rechercher

Ce contenu n'est pas disponible dans la langue sélectionnée.

3.6. Software Collection .pc Files Support

download PDF
The .pc files are special metadata files used by the pkg-config program to store information about libraries available on the system.
In case you distribute .pc files that you intend to use only in the Software Collection environment or in addition to the .pc files installed on the system, update the PKG_CONFIG_PATH environment variable. Depending on what is defined in your .pc files, update the PKG_CONFIG_PATH environment variable for the %{_libdir} macro (which expands to the library directory, typically /usr/lib/ or /usr/lib64/), or for the %{_datadir} macro (which expands to the share directory, typically /usr/share/).
If the library directory is defined in your .pc files, update the PKG_CONFIG_PATH environment variable by adjusting the %install section of the Software Collection spec file as follows:
%install
cat >> %{buildroot}%{_scl_scripts}/enable << EOF
export PKG_CONFIG_PATH="%{_libdir}/pkgconfig\${PKG_CONFIG_PATH:+:\${PKG_CONFIG_PATH}}"
EOF
If the share directory is defined in your .pc files, update the PKG_CONFIG_PATH environment variable by adjusting the %install section of the Software Collection spec file as follows:
%install
cat >> %{buildroot}%{_scl_scripts}/enable << EOF
export PKG_CONFIG_PATH="%{_datadir}/pkgconfig\${PKG_CONFIG_PATH:+:\${PKG_CONFIG_PATH}}"
EOF
The two examples above both configure the enable scriptlet so that it ensures that the .pc files in the Software Collection are preferred over the .pc files available on the system if the Software Collection is enabled.
The Software Collection can provide a wrapper script that is visible to the system to enable the Software Collection, for example in the /usr/bin/ directory. In this case, ensure that the .pc files are visible to the system even if the Software Collection is disabled.
To allow your system to use .pc files from the disabled Software Collection, update the PKG_CONFIG_PATH environment variable with the paths to the .pc files associated with the Software Collection. Depending on what is defined in your .pc files, update the PKG_CONFIG_PATH environment variable for the %{_libdir} macro (which expands to the library directory), or for the %{_datadir} macro (which expands to the share directory).

Procedure 3.5. Updating the PKG_CONFIG_PATH environment variable for %{_libdir}

  1. To update the PKG_CONFIG_PATH environment variable for the %{_libdir} macro, create a custom script /etc/profile.d/name.sh. The script is preloaded when a shell is started on the system.
    For example, create the following file:
    %{?scl_prefix}pc-libdir.sh
  2. Use the pc-libdir.sh short script that modifies the PKG_CONFIG_PATH variable to refer to your .pc files:
    export PKG_CONFIG_PATH="%{_libdir}/pkgconfig:/opt/provider/software_collection/path/to/your/pc_files"
  3. Add the file to your Software Collection package's spec file:
    SOURCE2: %{?scl_prefix}pc-libdir.sh
  4. Install this file into the system /etc/profile.d/ directory by adjusting the %install section of the Software Collection package's spec file:
    %install
    install -p -c -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{?scl:%_root_sysconfdir}%{!?scl:%_sysconfdir}/profile.d/

Procedure 3.6. Updating the PKG_CONFIG_PATH environment variable for %{_datadir}

  1. To update the PKG_CONFIG_PATH environment variable for the %{_datadir} macro, create a custom script /etc/profile.d/name.sh. The script is preloaded when a shell is started on the system.
    For example, create the following file:
    %{?scl_prefix}pc-datadir.sh
  2. Use the pc-datadir.sh short script that modifies the PKG_CONFIG_PATH variable to refer to your .pc files:
    export PKG_CONFIG_PATH="%{_datadir}/pkgconfig:/opt/provider/software_collection/path/to/your/pc_files"
  3. Add the file to your Software Collection package's spec file:
    SOURCE2: %{?scl_prefix}pc-datadir.sh
  4. Install this file into the system /etc/profile.d/ directory by adjusting the %install section of the Software Collection package's spec file:
    %install
    install -p -c -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{?scl:%_root_sysconfdir}%{!?scl:%_sysconfdir}/profile.d/
Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.