Skip to content

Commit

Permalink
Merge pull request #2443 from kevinbackhouse/inih-from-library3
Browse files Browse the repository at this point in the history
Remove libinih from codebase and add it as a dependency instead
  • Loading branch information
kevinbackhouse authored Jan 4, 2023
2 parents b31b4ab + ba258cb commit 346e114
Show file tree
Hide file tree
Showing 20 changed files with 113 additions and 451 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libexpat1-dev zlib1g-dev libbrotli-dev
sudo apt-get install -y libexpat1-dev zlib1g-dev libbrotli-dev libinih-dev
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly_Linux_distributions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
# arch suffering this issue: https://github.com/abseil/abseil-cpp/issues/709
container_image: ["fedora:latest", "debian:10", "archlinux:base", "ubuntu:20.04", "tgagor/centos-stream:2.0.11", "alpine:3.13"]
container_image: ["fedora:latest", "debian:11", "archlinux:base", "ubuntu:22.04", "tgagor/centos:stream9", "alpine:3.17"]
compiler: [g++, clang++]
build_type: [Release, Debug]
shared_libraries: [ON, OFF]
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/on_PR_linux_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ jobs:
run: |
cd build-base_linux
cmake --install .
tree install
- name: Test
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/on_PR_mac_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
- name: install dependencies
run: |
brew install ninja
brew install inih
pushd /tmp
curl -LO https://github.com/google/googletest/archive/release-1.8.0.tar.gz
tar xzf release-1.8.0.tar.gz
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/on_PR_mac_special_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- name: install dependencies
run: |
brew install ninja
brew install inih
pushd /tmp
curl -LO https://github.com/google/googletest/archive/release-1.8.0.tar.gz
tar xzf release-1.8.0.tar.gz
Expand Down
15 changes: 14 additions & 1 deletion .github/workflows/on_PR_windows_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ jobs:
zlib:p
brotli:p
curl:p
meson:p
libinih:p
- name: Build
run: |
Expand All @@ -150,7 +152,7 @@ jobs:
matrix:
build_type: [Release]
shared_libraries: [ON]
platform: [x64]
platform: [x86_64]
name: Cygwin ${{matrix.platform}} - BuildType:${{matrix.build_type}} - SHARED:${{matrix.shared_libraries}}
env:
SHELLOPTS: igncr
Expand Down Expand Up @@ -180,6 +182,17 @@ jobs:
libbrotlicommon1
libbrotlidec1
libbrotli-devel
meson
ccache
- name: Build and install inih
run: |
git clone https://github.com/benhoyt/inih.git inih_build && \
cd inih_build && \
git checkout r56 && \
meson --buildtype=plain --prefix=/usr builddir && \
meson compile -C builddir && \
meson install -C builddir
- name: Build
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/on_push_BasicWinLinMac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ jobs:
- name: install dependencies
run: |
brew install ninja
brew install inih
pushd /tmp
curl -LO https://github.com/google/googletest/archive/release-1.8.0.tar.gz
tar xzf release-1.8.0.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ Update your system and install the build tools and dependencies (zlib, expat, gt
```bash
$ sudo apt --yes update
$ sudo apt install --yes build-essential git clang ccache python3 libxml2-utils cmake python3 libexpat1-dev libz-dev zlib1g-dev libbrotli-dev libssh-dev libcurl4-openssl-dev libgtest-dev google-mock
$ sudo apt install --yes build-essential git clang ccache python3 libxml2-utils cmake python3 libexpat1-dev libz-dev zlib1g-dev libbrotli-dev libssh-dev libcurl4-openssl-dev libgtest-dev google-mock libinih-dev
```
For users of other platforms, the script <exiv2dir>/ci/install_dependencies.sh has code used to configure many platforms. The code in that file is a useful guide to configuring your platform.
Expand Down
34 changes: 26 additions & 8 deletions ci/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ debian_build_gtest() {
cd ..
}

# Centos doesn't have a working version of the inih library, so we need to build it ourselves.
centos_build_inih() {
[-d inih_build ] || git clone https://github.com/benhoyt/inih.git inih_build
cd inih_build
git checkout r56
meson --buildtype=plain builddir
meson compile -C builddir
meson install -C builddir
cd ..
}

# workaround for really bare-bones Archlinux containers:
if [ -x "$(command -v pacman)" ]; then
pacman --noconfirm -Sy
Expand All @@ -30,39 +41,46 @@ distro_id=$(grep '^ID=' /etc/os-release|awk -F = '{print $2}'|sed 's/\"//g')

case "$distro_id" in
'fedora')
dnf -y --refresh install gcc-c++ clang cmake make expat-devel zlib-devel brotli-devel libssh-devel libcurl-devel gtest-devel which dos2unix glibc-langpack-en diffutils
dnf -y --refresh install gcc-c++ clang cmake make expat-devel zlib-devel brotli-devel libssh-devel libcurl-devel gtest-devel which dos2unix glibc-langpack-en diffutils inih-devel
;;

'debian')
apt-get update
apt-get install -y cmake g++ clang make libexpat1-dev zlib1g-dev libbrotli-dev libssh-dev libcurl4-openssl-dev libgtest-dev libxml2-utils
apt-get install -y cmake g++ clang make libexpat1-dev zlib1g-dev libbrotli-dev libssh-dev libcurl4-openssl-dev libgtest-dev libxml2-utils libinih-dev
debian_build_gtest
;;

'arch')
pacman --noconfirm -Syu
pacman --noconfirm --needed -S gcc clang cmake make expat zlib brotli libssh curl gtest dos2unix which diffutils
pacman --noconfirm --needed -S gcc clang cmake make expat zlib brotli libssh curl gtest dos2unix which diffutils libinih
;;

'ubuntu')
apt-get update
apt-get install -y cmake g++ clang make libexpat1-dev zlib1g-dev libbrotli-dev libssh-dev libcurl4-openssl-dev libgtest-dev google-mock libxml2-utils
apt-get install -y cmake g++ clang make libexpat1-dev zlib1g-dev libbrotli-dev libssh-dev libcurl4-openssl-dev libgtest-dev google-mock libxml2-utils libinih-dev
debian_build_gtest
;;

'alpine')
apk update
apk add gcc g++ clang cmake make expat-dev zlib-dev brotli-dev libssh-dev curl-dev gtest gtest-dev gmock libintl gettext-dev which dos2unix bash libxml2-utils diffutils
apk add gcc g++ clang cmake make expat-dev zlib-dev brotli-dev libssh-dev curl-dev gtest gtest-dev gmock libintl gettext-dev which dos2unix bash libxml2-utils diffutils inih-dev inih-inireader-dev
;;

'rhel')
dnf clean all
dnf -y install gcc-c++ clang cmake make expat-devel zlib-devel brotli-devel libssh-devel libcurl-devel which dos2unix inih-devel
;;

'centos'|'rhel')
'centos')
dnf clean all
dnf -y install gcc-c++ clang cmake make expat-devel zlib-devel brotli-devel libssh-devel libcurl-devel which dos2unix
dnf -y install gcc-c++ clang cmake make expat-devel zlib-devel brotli-devel libssh-devel libcurl-devel which dos2unix git
dnf -y --enablerepo=crb install meson
centos_build_inih
;;

'opensuse-tumbleweed')
zypper --non-interactive refresh
zypper --non-interactive install gcc-c++ clang cmake make libexpat-devel zlib-devel libbrotli-devel libssh-devel curl libcurl-devel git which dos2unix libxml2-tools
zypper --non-interactive install gcc-c++ clang cmake make libexpat-devel zlib-devel libbrotli-devel libssh-devel curl libcurl-devel git which dos2unix libxml2-tools libinih-devel
pushd /tmp
curl -LO https://github.com/google/googletest/archive/release-1.8.0.tar.gz
tar xzf release-1.8.0.tar.gz
Expand Down
45 changes: 45 additions & 0 deletions cmake/Findinih.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
set(inih_LIBRARY_NAMES "inih" "libinih")
set(inih_inireader_LIBRARY_NAMES "INIReader" "libINIReader")

find_path(inih_INCLUDE_DIR
NAMES "ini.h"
DOC "inih include directory")

find_path(inih_inireader_INCLUDE_DIR
NAMES "INIReader.h"
DOC "INIReader include directory")

find_library(inih_LIBRARY
NAMES ${inih_LIBRARY_NAMES}
DOC "inih library")

find_library(inih_inireader_LIBRARY
NAMES ${inih_inireader_LIBRARY_NAMES}
DOC "inih library")

mark_as_advanced(inih_INCLUDE_DIR)
mark_as_advanced(inih_LIBRARY)
mark_as_advanced(inih_inireader_INCLUDE_DIR)
mark_as_advanced(inih_inireader_LIBRARY)

find_package_handle_standard_args(inih REQUIRED_VARS inih_LIBRARY inih_INCLUDE_DIR)

if(NOT inih_FOUND)
message(FATAL_ERROR "inih library not found")
endif()

set(inih_INCLUDE_DIRS "${inih_INCLUDE_DIR}")
set(inih_LIBRARIES "${inih_LIBRARY}")
if(NOT TARGET inih::libinih)
add_library(inih::libinih INTERFACE IMPORTED)
endif()
set_property(TARGET inih::libinih PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${inih_INCLUDE_DIRS}")
set_property(TARGET inih::libinih PROPERTY INTERFACE_LINK_LIBRARIES "${inih_LIBRARIES}")

set(inih_inireader_INCLUDE_DIRS "${inih_inireader_INCLUDE_DIR}")
set(inih_inireader_LIBRARIES "${inih_inireader_LIBRARY}")
if(NOT TARGET inih::inireader)
add_library(inih::inireader INTERFACE IMPORTED)
endif()
set_property(TARGET inih::inireader PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${inih_inireader_INCLUDE_DIRS}")
set_property(TARGET inih::inireader PROPERTY INTERFACE_LINK_LIBRARIES "${inih_inireader_LIBRARIES}")
6 changes: 6 additions & 0 deletions cmake/findDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ if( ICONV_FOUND )
message ( "-- Iconv_LIBRARIES : " ${Iconv_LIBRARIES} )
endif()

find_package(inih)
message ( "-- inih_INCLUDE_DIRS : " ${inih_INCLUDE_DIRS} )
message ( "-- inih_LIBRARIES : " ${inih_LIBRARIES} )
message ( "-- inih_inireader_INCLUDE_DIRS : " ${inih_inireader_INCLUDE_DIRS} )
message ( "-- inih_inireader_LIBRARIES : " ${inih_inireader_LIBRARIES} )

if( BUILD_WITH_CCACHE )
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
Expand Down
2 changes: 2 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def requirements(self):

self.requires('brotli/1.0.9')

self.requires('inih/55')

if self.options.webready:
self.requires('libcurl/7.85.0')

Expand Down
1 change: 0 additions & 1 deletion include/exiv2/exiv2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "exiv2/gifimage.hpp"
#include "exiv2/http.hpp"
#include "exiv2/image.hpp"
#include "exiv2/ini.hpp"
#include "exiv2/iptc.hpp"
#include "exiv2/jp2image.hpp"
#include "exiv2/jpgimage.hpp"
Expand Down
Loading

0 comments on commit 346e114

Please sign in to comment.