Topic: Help packaging pho-pdo-informix

Hello,

I like to package PDO_INFORMIX for 5.3 5.6 and 7.x,
and I like to make the process repeatable and automated.

until now I was compiling it under Docker for CentOS6 and CentOS7 manually (automated the build with scripts)
but still the output was a single file which i had to manage manually.

I like to package pdo_informix as rpm, this is my current spec file

%define     informixdir     /opt/informix-csdk-3.70.FC4
%define     informixdir     /opt/informix

Name:       php-pdo-informix
Version:    1.3.3
Release:    1%{?dist}
Summary:    PDO driver for IBM Informix INFORMIX databases

Group:      Development/Languages
License:    Apache License 2.0

Source0:    https://pecl.php.net/get/PDO_INFORMIX-%{version}.tgz
Source1:    clientsdk.3.70.FC8DE.LINUX.tar
Source2:    clientsdk.3.70.answerfile


BuildRequires:  gcc autoconf make file
BuildRequires:  php-devel

Requires:   php-pdo

%description
This extension provides an IBM Informix Dynamic Server driver for PDO. To build and run
PDO_INFORMIX, you must install the Informix Client Software Development Kit (CSDK)
from ibm . com/informix/downloads.html.

%prep
export INFORMIX_CLIENTSDK_DOWNLOAD_FOLDER=/tmp/informix_clientsdk_download_folder

# extract Source1
mkdir -p "${INFORMIX_CLIENTSDK_DOWNLOAD_FOLDER}" && cd "${INFORMIX_CLIENTSDK_DOWNLOAD_FOLDER}"
tar -xvf "%{SOURCE1}" -C "${INFORMIX_CLIENTSDK_DOWNLOAD_FOLDER}"

# Install Source1 using Source2
cp -v "%{SOURCE2}" "${INFORMIX_CLIENTSDK_DOWNLOAD_FOLDER}/"
#[ -d "${INFORMIXDIR}" ] || INFORMIXDIR=%{informixdir} ./installclientsdk -i silent -f "%{SOURCE2}"

# extract source0
%setup -q -n PDO_INFORMIX-%{version}

%build
phpize
./configure --prefix="${RPM_BUILD_ROOT}/usr" --with-pdo-informix="%{informixdir}"
#make %{?_smp_mflags}
make


%install
%make_install


%files
%doc



%changelog

the current problem is that when running the %make_install macro,
it tries to install the module to "/usr/lib64/php/modules"
and not under the build folder "/home/builder/rpmbuild/BUILDROOT/php-pdo-informix-1.3.3-1.el7.centos.x86_64"

Re: Help packaging pho-pdo-informix

> the current problem is that when running the %make_install macro,

Don't use it wink

make install INSTALL_ROOT=%{buildroot}
Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Help packaging pho-pdo-informix

Thanks, that did the trick :)

but now that the packing complete I encounter a new problem, where I can't install the package.
I get the following errors,

# yum install ../RPMS/x86_64/php-pdo-informix-1.3.3-1.el7.centos.x86_64.rpm 
Loaded plugins: fastestmirror, ovl
Examining ../RPMS/x86_64/php-pdo-informix-1.3.3-1.el7.centos.x86_64.rpm: php-pdo-informix-1.3.3-1.el7.centos.x86_64
Marking ../RPMS/x86_64/php-pdo-informix-1.3.3-1.el7.centos.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package php-pdo-informix.x86_64 0:1.3.3-1.el7.centos will be installed
--> Processing Dependency: php-pdo for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
Loading mirror speeds from cached hostfile
 * base: centos.aumix.net
 * epel: mirror.nonstop.co.il
 * extras: centos.aumix.net
 * remi-safe: remi.mirror.wearetriple.com
 * updates: centos.aumix.net
--> Processing Dependency: libifasf.so()(64bit) for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
--> Processing Dependency: libifcli.so()(64bit) for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
--> Processing Dependency: libifdmr.so()(64bit) for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
--> Processing Dependency: libifgen.so()(64bit) for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
--> Processing Dependency: libifgls.so()(64bit) for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
--> Processing Dependency: libifglx.so()(64bit) for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
--> Processing Dependency: libifos.so()(64bit) for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
--> Processing Dependency: libifsql.so()(64bit) for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
--> Running transaction check
---> Package php-pdo.x86_64 0:5.4.16-42.el7 will be installed
---> Package php-pdo-informix.x86_64 0:1.3.3-1.el7.centos will be installed
--> Processing Dependency: libifasf.so()(64bit) for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
--> Processing Dependency: libifcli.so()(64bit) for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
--> Processing Dependency: libifdmr.so()(64bit) for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
--> Processing Dependency: libifgen.so()(64bit) for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
--> Processing Dependency: libifgls.so()(64bit) for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
--> Processing Dependency: libifglx.so()(64bit) for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
--> Processing Dependency: libifos.so()(64bit) for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
--> Processing Dependency: libifsql.so()(64bit) for package: php-pdo-informix-1.3.3-1.el7.centos.x86_64
--> Finished Dependency Resolution
Error: Package: php-pdo-informix-1.3.3-1.el7.centos.x86_64 (/php-pdo-informix-1.3.3-1.el7.centos.x86_64)
           Requires: libifgls.so()(64bit)
Error: Package: php-pdo-informix-1.3.3-1.el7.centos.x86_64 (/php-pdo-informix-1.3.3-1.el7.centos.x86_64)
           Requires: libifglx.so()(64bit)
Error: Package: php-pdo-informix-1.3.3-1.el7.centos.x86_64 (/php-pdo-informix-1.3.3-1.el7.centos.x86_64)
           Requires: libifasf.so()(64bit)
Error: Package: php-pdo-informix-1.3.3-1.el7.centos.x86_64 (/php-pdo-informix-1.3.3-1.el7.centos.x86_64)
           Requires: libifdmr.so()(64bit)
Error: Package: php-pdo-informix-1.3.3-1.el7.centos.x86_64 (/php-pdo-informix-1.3.3-1.el7.centos.x86_64)
           Requires: libifos.so()(64bit)
Error: Package: php-pdo-informix-1.3.3-1.el7.centos.x86_64 (/php-pdo-informix-1.3.3-1.el7.centos.x86_64)
           Requires: libifsql.so()(64bit)
Error: Package: php-pdo-informix-1.3.3-1.el7.centos.x86_64 (/php-pdo-informix-1.3.3-1.el7.centos.x86_64)
           Requires: libifgen.so()(64bit)
Error: Package: php-pdo-informix-1.3.3-1.el7.centos.x86_64 (/php-pdo-informix-1.3.3-1.el7.centos.x86_64)
           Requires: libifcli.so()(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

All the *.so above are installed by the Informix Client SDK.

I'm including the rpmbuild output (and yes I compile as root because part of the build require the installation of informix csdk to the system):

[root@1d2009018971 SOURCES]# rpmbuild -ba ../SPECS/pdo_informix.spec 
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.X3HijO
+ umask 022
+ cd /root/rpmbuild/BUILD
+ export INFORMIX_CLIENTSDK_DOWNLOAD_FOLDER=/tmp/informix_clientsdk_download_folder
+ INFORMIX_CLIENTSDK_DOWNLOAD_FOLDER=/tmp/informix_clientsdk_download_folder
+ export INFORMIXDIR=/opt/informix
+ INFORMIXDIR=/opt/informix
+ [[ ! -d /tmp/informix_clientsdk_download_folder ]]
+ cp -v /root/rpmbuild/SOURCES/clientsdk.3.70.answerfile /tmp/informix_clientsdk_download_folder/
'/root/rpmbuild/SOURCES/clientsdk.3.70.answerfile' -> '/tmp/informix_clientsdk_download_folder/clientsdk.3.70.answerfile'
+ cd /tmp/informix_clientsdk_download_folder/
+ [[ ! -d /opt/informix ]]
+ cd /root/rpmbuild/BUILD
+ rm -rf PDO_INFORMIX-1.3.3
+ /usr/bin/gzip -dc /root/rpmbuild/SOURCES/PDO_INFORMIX-1.3.3.tgz
+ /usr/bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd PDO_INFORMIX-1.3.3
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.TIBCDA
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd PDO_INFORMIX-1.3.3
+ phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
+ ./configure --prefix=/root/rpmbuild/BUILDROOT/php-pdo-informix-1.3.3-1.el7.centos.x86_64/usr --with-pdo-informix=/opt/informix
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib64/php/modules
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for Informix driver for PDO... yes, shared
checking for PDO includes... /usr/include/php/ext
checking for includes and libraries... /opt/informix
checking Informix version... /opt/informix/bin/esql: line 517: /usr/informix/lib/esql/esqlc: No such file or directory

./configure: line 4151: test: -ge: unary operator expected
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
+ make
/bin/sh /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/libtool --mode=compile cc -I/usr/include/php/ext -I. -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3 -DPHP_ATOM_INC -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/include -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/main -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/opt/informix/incl/cli -I/opt/informix/incl/esql  -DHAVE_CONFIG_H  -g -O2   -c /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/pdo_informix.c -o pdo_informix.lo 
libtool: compile:  cc -I/usr/include/php/ext -I. -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3 -DPHP_ATOM_INC -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/include -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/main -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/opt/informix/incl/cli -I/opt/informix/incl/esql -DHAVE_CONFIG_H -g -O2 -c /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/pdo_informix.c  -fPIC -DPIC -o .libs/pdo_informix.o
/bin/sh /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/libtool --mode=compile cc -I/usr/include/php/ext -I. -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3 -DPHP_ATOM_INC -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/include -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/main -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/opt/informix/incl/cli -I/opt/informix/incl/esql  -DHAVE_CONFIG_H  -g -O2   -c /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/informix_driver.c -o informix_driver.lo 
libtool: compile:  cc -I/usr/include/php/ext -I. -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3 -DPHP_ATOM_INC -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/include -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/main -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/opt/informix/incl/cli -I/opt/informix/incl/esql -DHAVE_CONFIG_H -g -O2 -c /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/informix_driver.c  -fPIC -DPIC -o .libs/informix_driver.o
/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/informix_driver.c: In function 'dbh_prepare_stmt':
/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/informix_driver.c:86:4: warning: passing argument 5 of 'pdo_parse_params' from incompatible pointer type [enabled by default]
    &converted_len TSRMLS_CC);
    ^
In file included from /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/informix_driver.c:30:0:
/usr/include/php/ext/pdo/php_pdo_driver.h:652:13: note: expected 'int *' but argument is of type 'size_t *'
 PDO_API int pdo_parse_params(pdo_stmt_t *stmt, char *inquery, int inquery_len, 
             ^
/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/informix_driver.c: At top level:
/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/informix_driver.c:583:2: warning: initialization from incompatible pointer type [enabled by default]
  informix_handle_preparer,
  ^
/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/informix_driver.c:583:2: warning: (near initialization for 'informix_dbh_methods.preparer') [enabled by default]
/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/informix_driver.c:584:2: warning: initialization from incompatible pointer type [enabled by default]
  informix_handle_doer,
  ^
/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/informix_driver.c:584:2: warning: (near initialization for 'informix_dbh_methods.doer') [enabled by default]
/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/informix_driver.c:585:2: warning: initialization from incompatible pointer type [enabled by default]
  informix_handle_quoter,  
  ^
/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/informix_driver.c:585:2: warning: (near initialization for 'informix_dbh_methods.quoter') [enabled by default]
/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/informix_driver.c:590:2: warning: initialization from incompatible pointer type [enabled by default]
  informix_handle_lastInsertID,
  ^
/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/informix_driver.c:590:2: warning: (near initialization for 'informix_dbh_methods.last_id') [enabled by default]
/bin/sh /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/libtool --mode=compile cc -I/usr/include/php/ext -I. -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3 -DPHP_ATOM_INC -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/include -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/main -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/opt/informix/incl/cli -I/opt/informix/incl/esql  -DHAVE_CONFIG_H  -g -O2   -c /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/informix_statement.c -o informix_statement.lo 
libtool: compile:  cc -I/usr/include/php/ext -I. -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3 -DPHP_ATOM_INC -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/include -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/main -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/opt/informix/incl/cli -I/opt/informix/incl/esql -DHAVE_CONFIG_H -g -O2 -c /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/informix_statement.c  -fPIC -DPIC -o .libs/informix_statement.o
/bin/sh /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/libtool --mode=link cc -DPHP_ATOM_INC -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/include -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/main -I/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/opt/informix/incl/cli -I/opt/informix/incl/esql  -DHAVE_CONFIG_H  -g -O2   -o pdo_informix.la -export-dynamic -avoid-version -prefer-pic -module -rpath /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/modules  pdo_informix.lo informix_driver.lo informix_statement.lo -Wl,-rpath,/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/. -L/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/. -Wl,-rpath,/opt/informix/lib/esql -L/opt/informix/lib/esql -Wl,-rpath,/opt/informix/lib/cli -L/opt/informix/lib/cli -Wl,-rpath,/opt/informix/lib -L/opt/informix/lib -lifcli -lifdmr -lifsql -lifasf -lifgen -lifos -lifgls -ldl -lcrypt -lifglx
libtool: link: cc -shared  -fPIC -DPIC  .libs/pdo_informix.o .libs/informix_driver.o .libs/informix_statement.o   -L/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/. -L/opt/informix/lib/esql -L/opt/informix/lib/cli -L/opt/informix/lib -lifcli -lifdmr -lifsql -lifasf -lifgen -lifos -lifgls -ldl -lcrypt -lifglx  -O2 -Wl,-rpath -Wl,/root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/. -Wl,-rpath -Wl,/opt/informix/lib/esql -Wl,-rpath -Wl,/opt/informix/lib/cli -Wl,-rpath -Wl,/opt/informix/lib   -Wl,-soname -Wl,pdo_informix.so -o .libs/pdo_informix.so
libtool: link: ( cd ".libs" && rm -f "pdo_informix.la" && ln -s "../pdo_informix.la" "pdo_informix.la" )
/bin/sh /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/libtool --mode=install cp ./pdo_informix.la /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/modules
libtool: install: cp ./.libs/pdo_informix.so /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/modules/pdo_informix.so
libtool: install: cp ./.libs/pdo_informix.lai /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/modules/pdo_informix.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.dpIgdu
+ umask 022
+ cd /root/rpmbuild/BUILD
+ '[' /root/rpmbuild/BUILDROOT/php-pdo-informix-1.3.3-1.el7.centos.x86_64 '!=' / ']'
+ rm -rf /root/rpmbuild/BUILDROOT/php-pdo-informix-1.3.3-1.el7.centos.x86_64
++ dirname /root/rpmbuild/BUILDROOT/php-pdo-informix-1.3.3-1.el7.centos.x86_64
+ mkdir -p /root/rpmbuild/BUILDROOT
+ mkdir /root/rpmbuild/BUILDROOT/php-pdo-informix-1.3.3-1.el7.centos.x86_64
+ cd PDO_INFORMIX-1.3.3
+ make install INSTALL_ROOT=/root/rpmbuild/BUILDROOT/php-pdo-informix-1.3.3-1.el7.centos.x86_64
Installing shared extensions:     /root/rpmbuild/BUILDROOT/php-pdo-informix-1.3.3-1.el7.centos.x86_64/usr/lib64/php/modules/
+ mkdir -p /root/rpmbuild/BUILDROOT/php-pdo-informix-1.3.3-1.el7.centos.x86_64//etc/php.d/
+ install --mode 644 -vD /root/rpmbuild/SOURCES/pdo_informix.ini /root/rpmbuild/BUILDROOT/php-pdo-informix-1.3.3-1.el7.centos.x86_64/etc/php.d/pdo_informix.ini
'/root/rpmbuild/SOURCES/pdo_informix.ini' -> '/root/rpmbuild/BUILDROOT/php-pdo-informix-1.3.3-1.el7.centos.x86_64/etc/php.d/pdo_informix.ini'
+ tree /root/rpmbuild/BUILDROOT/php-pdo-informix-1.3.3-1.el7.centos.x86_64
/root/rpmbuild/BUILDROOT/php-pdo-informix-1.3.3-1.el7.centos.x86_64
|-- etc
|   `-- php.d
|       `-- pdo_informix.ini
`-- usr
    `-- lib64
        `-- php
            `-- modules
                `-- pdo_informix.so

6 directories, 2 files
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id -m --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 /root/rpmbuild/BUILD/PDO_INFORMIX-1.3.3
extracting debug info from /root/rpmbuild/BUILDROOT/php-pdo-informix-1.3.3-1.el7.centos.x86_64/usr/lib64/php/modules/pdo_informix.so
dwz: Too few files for multifile optimization
/usr/lib/rpm/sepdebugcrcfix: Updated 1 CRC32s, 0 CRC32s did match.
166 blocks
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: php-pdo-informix-1.3.3-1.el7.centos.x86_64
Provides: php-pdo-informix = 1.3.3-1.el7.centos php-pdo-informix(x86-64) = 1.3.3-1.el7.centos
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libcrypt.so.1()(64bit) libdl.so.2()(64bit) libifasf.so()(64bit) libifcli.so()(64bit) libifdmr.so()(64bit) libifgen.so()(64bit) libifgls.so()(64bit) libifglx.so()(64bit) libifos.so()(64bit) libifsql.so()(64bit) rtld(GNU_HASH)
Processing files: php-pdo-informix-debuginfo-1.3.3-1.el7.centos.x86_64
Provides: php-pdo-informix-debuginfo = 1.3.3-1.el7.centos php-pdo-informix-debuginfo(x86-64) = 1.3.3-1.el7.centos
Requires(rpmlib): rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/php-pdo-informix-1.3.3-1.el7.centos.x86_64
Wrote: /root/rpmbuild/SRPMS/php-pdo-informix-1.3.3-1.el7.centos.src.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/php-pdo-informix-1.3.3-1.el7.centos.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/php-pdo-informix-debuginfo-1.3.3-1.el7.centos.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.CaVRjS
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd PDO_INFORMIX-1.3.3
+ /usr/bin/rm -rf /root/rpmbuild/BUILDROOT/php-pdo-informix-1.3.3-1.el7.centos.x86_64
+ exit 0

Re: Help packaging pho-pdo-informix

Proper way:
- package the informix SDK separately
- use previous during build

Bad way:
- disable auto dependencies

AutoReq:        0

> and yes I compile as root because part of the build require the installation of informix csdk to the system)

I know (I have build it few years ago... terrible stuff)

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

5 (edited by rabin 2017-05-14 10:01:52)

Re: Help packaging pho-pdo-informix

Remi wrote:

Bad way:
- disable auto dependencies

AutoReq:        0

Yes that helped to package and make it installable on the system.
one thing I forgot to mention was that I set "QA_RPATHS" to ignore error "0x0002" (see output)

+ case "${QA_CHECK_RPATHS:-}" in
+ /usr/lib/rpm/check-rpaths
*******************************************************************************
*
* WARNING: 'check-rpaths' detected a broken RPATH and will cause 'rpmbuild'
*          to fail. To ignore these errors, you can set the '$QA_RPATHS'
*          environment variable which is a bitmask allowing the values
*          below. The current value of QA_RPATHS is 0x0000.
*
*    0x0001 ... standard RPATHs (e.g. /usr/lib); such RPATHs are a minor
*               issue but are introducing redundant searchpaths without
*               providing a benefit. They can also cause errors in multilib
*               environments.
*    0x0002 ... invalid RPATHs; these are RPATHs which are neither absolute
*               nor relative filenames and can therefore be a SECURITY risk
*    0x0004 ... insecure RPATHs; these are relative RPATHs which are a
*               SECURITY risk
*    0x0008 ... the special '$ORIGIN' RPATHs are appearing after other
*               RPATHs; this is just a minor issue but usually unwanted
*    0x0010 ... the RPATH is empty; there is no reason for such RPATHs
*               and they cause unneeded work while loading libraries
*    0x0020 ... an RPATH references '..' of an absolute path; this will break
*               the functionality when the path before '..' is a symlink
*          
*
* Examples:
* - to ignore standard and empty RPATHs, execute 'rpmbuild' like
*   $ QA_RPATHS=$[ 0x0001|0x0010 ] rpmbuild my-package.src.rpm
* - to check existing files, set $RPM_BUILD_ROOT and execute check-rpaths like
*   $ RPM_BUILD_ROOT=<top-dir> /usr/lib/rpm/check-rpaths
*  
*******************************************************************************
ERROR   0002: file '/usr/lib64/php/modules/pdo_informix.so' contains an invalid rpath '/home/builder/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/.' in [/home/builder/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/.:/opt/informix/lib/esql:/opt/informix/lib/cli:/opt/informix/lib]
ERROR   0002: file '/usr/lib64/php/modules/pdo_informix.so' contains an invalid rpath '/opt/informix/lib/esql' in [/home/builder/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/.:/opt/informix/lib/esql:/opt/informix/lib/cli:/opt/informix/lib]
ERROR   0002: file '/usr/lib64/php/modules/pdo_informix.so' contains an invalid rpath '/opt/informix/lib/cli' in [/home/builder/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/.:/opt/informix/lib/esql:/opt/informix/lib/cli:/opt/informix/lib]
ERROR   0002: file '/usr/lib64/php/modules/pdo_informix.so' contains an invalid rpath '/opt/informix/lib' in [/home/builder/rpmbuild/BUILD/PDO_INFORMIX-1.3.3/.:/opt/informix/lib/esql:/opt/informix/lib/cli:/opt/informix/lib]

which make me think that is related to this next part, do I need to install the informix CDSK into %{buildroot} i.e ( %{buildroot}/opt/informix ?)
and what about the files which are installed into "/usr/local/ibm" , "/usr/bin", "/usr/lib64" ?
(you can see the fpaste https://da.gd/TvAtd of the files added by installer)

Remi wrote:

Proper way:
- package the informix SDK separately
- use previous during build

Can you guide me how to accomplish this ?

Remi wrote:

> and yes I compile as root because part of the build require the installation of informix csdk to the system)

I know (I have build it few years ago... terrible stuff)

Thank you very much, have you documented this process or have resources I can use for this ?

One again Thank you :)

Re: Help packaging pho-pdo-informix

> Thank you very much, have you documented this process or have resources I can use for this ?

Sorry, this private work was the property of my previous employer, and I haven't keep any copy of it.
Just remember having build this (on RHEL-4...)

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Help packaging pho-pdo-informix

So how should I approach this ?

Install the Informix CSDK copy all the files which the installer add to the system over to the buildroot folder and package it as informix-csdk.$version.rpm and then add the package as a BuildRequires for informix-pdo ?

Re: Help packaging pho-pdo-informix

Digging in my archive I found a old spec file

%define informixdir /usr/informix

%define debug_package %{nil}

Summary:     Informix Client Software Development Kit
Name:        informix-csdk
%ifarch x86_64
Version:     3.50.FC3DE
%else
Version:     3.50.UC3DE
%endif
Release:     1%{?dist}
Group:       Applications/Databases
License:     Copyright (C) IBM
URL:         http://www-01.ibm.com/software/data/informix/linux/csdk.html

Source0:      clientsdk.%{version}.LINUX.tar
Source1:      %{name}-license

# Don't try to use system Java
Patch0:       %{name}-java.patch

BuildRoot:   %{_tmppath}/%{name}-%{version}-%{release}-root

Requires:    shadow-utils


%description
Informix Client SDK (Software Development Kit) provides the ability to
develop software that accesses Informix Dynamic Server (IDS) on Linux.



%prep
%setup -q -c

%patch0 -p0

cp %{SOURCE1} LICENSE

cat >%{name}.conf <<EOF
%{informixdir}/lib
%{informixdir}/lib/esql
EOF

cat >%{name}.sh <<EOF
# Define Informix environment variable
INFORMIXDIR=%{informixdir}
INFORMIXSQLHOSTS=%{informixdir}/etc/sqlhosts
INFORMIXSERVER=demo_on
PATH=\$PATH:%{informixdir}/bin
export INFORMIXDIR INFORMIXSQLHOSTS INFORMIXSERVER
EOF

# Options for silent install
sed -e /licenseAccepted/s,false,true, \
    -e /installLocation/s,/usr/informix,$RPM_BUILD_ROOT%{informixdir}, \
    csdk.ini >%{name}.ini

%build
# Rien a faire


%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT


%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT


# Libraries path
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d
%{__install} %{name}.conf $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d

# User environment
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
%{__install} %{name}.sh $RPM_BUILD_ROOT%{_sysconfdir}/profile.d

./installclientsdk -options %{name}.ini -silent

# Don't need this file in the RPM
%{__rm} -rf $RPM_BUILD_ROOT%{informixdir}/uninstall_csdk
%{__rm} -f  $RPM_BUILD_ROOT%{informixdir}/tmp/*


%pre
# Creation du compte utilisateur informix
getent group  informix >/dev/null || \
  groupadd -r informix
getent passwd informix >/dev/null || \
  useradd -r -g informix -d %{informixdir} -s /sbin/nologin informix
exit 0

%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig


%files
%defattr(-,informix,informix,-)
%doc LICENSE doc/*.txt
%{informixdir}
%{_sysconfdir}/profile.d/%{name}.sh
%config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{name}.conf

%changelog
* Sun Jan 11 2009 Remi Collet <remi.collet@xxx.fr> 3.50.{U,F}C3-1
- initial RPM for 3.50

Warning: this is a 8 years old spec, for EL-4, no idea if same thing work nowadays.

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Help packaging pho-pdo-informix

For the rpath issue with the php extension try adding, before the build

export PHP_RPATH=no
Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Help packaging pho-pdo-informix

Thanks a lot Remi,
After straggling with it for a day I was able to package php-pdo-informix and the informix-csdk
and setup a small RPM repo to pull the packages from it.

This is the current

%define informixdir /opt/informix
%define debug_package %{nil}

Summary:     Informix Client Software Development Kit
Name:        informix-csdk
%ifarch x86_64
Version:     3.70.FC8DE
%else
Version:     ELSE
%endif
Release:     1%{?dist}
Group:       Applications/Databases
License:     Copyright (C) IBM
URL:         http://www-01.ibm.com/software/data/informix/linux/csdk.html

Source0:      http://repo.rabin.io/informix_sdk/clientsdk.%{version}.LINUX.tar
#Source1:      %{name}-license
Source2:       %{name}.ini

#Patch1:        %{name}_installgskit.patch

AutoReq:        0
BuildRequires:  gcc autoconf make file

# Don't try to use system Java
#Patch0:       %{name}-java.patch

BuildRoot:   %{_tmppath}/%{name}-%{version}-%{release}-root

Requires:    shadow-utils


%description
Informix Client SDK (Software Development Kit) provides the ability to
develop software that accesses Informix Dynamic Server (IDS) on Linux.


%prep
%setup -q -c

cat >%{name}.conf <<EOF
%{informixdir}/lib
%{informixdir}/lib/esql
EOF

cat >%{name}.sh <<EOF
# Define Informix environment variable
INFORMIXDIR=%{informixdir}
INFORMIXSQLHOSTS=%{informixdir}/etc/sqlhosts
INFORMIXSERVER=demo_on
PATH=\$PATH:%{informixdir}/bin
export INFORMIXDIR INFORMIXSQLHOSTS INFORMIXSERVER
EOF

# Options for silent install
sed -e /^LICENSE_ACCEPTED/s,=.*,=TRUE, \
    -e /^USER_INSTALL_DIR/s,=.*,=$RPM_BUILD_ROOT%{informixdir}, \
    %{SOURCE2} > %{name}.ini

%build
# Nothing to do


%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT


%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

# Libraries path
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d
%{__install} %{name}.conf $RPM_BUILD_ROOT%{_sysconfdir}/ld.so.conf.d

# User environment
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
%{__install} %{name}.sh $RPM_BUILD_ROOT%{_sysconfdir}/profile.d

# java installer
./installclientsdk -i silent -f "%{name}.ini"

# install 
tar -C /tmp/ -xvf ${RPM_BUILD_ROOT}%{informixdir}/gskit/gskcrypt*.tar
tar -C /tmp/ -xvf ${RPM_BUILD_ROOT}%{informixdir}/gskit/gskssl*.tar

find /tmp -type f -name "gsk*.rpm" -exec rpm --prefix=${RPM_BUILD_ROOT}/usr/local --force -Uv --nodeps --ignoresize '{}' \;

# will fail checkroot

# Don't need this file in the RPM
%{__rm} -vrf ${RPM_BUILD_ROOT}%{informixdir}/IBM_Informix_Client_SDK_Install_*.log
%{__rm} -vrf ${RPM_BUILD_ROOT}%{informixdir}/IBM_Informix_GLS_Install_*.log
%{__rm} -vrf ${RPM_BUILD_ROOT}%{informixdir}/uninstall/uninstall_clientsdk
%{__rm} -vrf ${RPM_BUILD_ROOT}%{informixdir}/uninstall_csdk
%{__rm} -vf  ${RPM_BUILD_ROOT}%{informixdir}/tmp/*
%{__rm} -vrf ${RPM_BUILD_ROOT}%{informixdir}/extend/krakatoa/docs/launchpad/splash/{hpuxparisc,linuxs390,sunsparc,hpuxia64,linuxppc}/AZY_Splash

#export QA_CHECK_RPATHS=0

%pre
# Creation du compte utilisateur informix
getent group  informix >/dev/null || \
  groupadd -r informix
getent passwd informix >/dev/null || \
  useradd -r -g informix -d %{informixdir} -s /sbin/nologin informix
exit 0

%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig


%files
%defattr(-,informix,informix,-)
#%doc LICENSE doc/*.txt
%doc doc/*.txt
%{informixdir}
%{_sysconfdir}/profile.d/%{name}.sh
%config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{name}.conf
/usr/local/ibm/

%changelog
* Sun Jan 11 2009 Remi Collet <remi.collet@xxx.fr> 3.50.{U,F}C3-1
- initial RPM for 3.50
%define     informixdir     /opt/informix

Name:       php-pdo-informix
Version:    1.3.3
Release:    1%{?dist}
Summary:    PDO driver for IBM Informix INFORMIX databases

Group:      Development/Languages
License:    Apache License 2.0
URL:        https://www.isoc.org.il
Source0:    https://pecl.php.net/get/PDO_INFORMIX-%{version}.tgz
Source1:    http://repo.rabin.io/informix_sdk/clientsdk.3.70.FC8DE.LINUX.tar
Source2:    http://repo.rabin.io/informix_sdk/clientsdk.3.70.answerfile
Source3:    pdo_informix.ini

BuildRequires:  gcc autoconf make file
BuildRequires:  php-devel
BuildRequires:  informix-csdk

Requires:   informix-csdk
Requires:   php-pdo

AutoReq:        0

%description
This extension provides an IBM Informix Dynamic Server driver for PDO. To build and run
PDO_INFORMIX, you must install the Informix Client Software Development Kit (CSDK)
from http://ibm.com/informix/downloads.html.

%prep

# extract Source1
export INFORMIX_CLIENTSDK_DOWNLOAD_FOLDER="/tmp/informix_clientsdk_download_folder"
export INFORMIXDIR="/opt/informix"

if [[ ! -d "${INFORMIX_CLIENTSDK_DOWNLOAD_FOLDER}" ]]; then
    mkdir -p "${INFORMIX_CLIENTSDK_DOWNLOAD_FOLDER}" 
    tar -xvf "%{SOURCE1}" -C "${INFORMIX_CLIENTSDK_DOWNLOAD_FOLDER}"
fi

# Install Source1 using Source2
cp -v "%{SOURCE2}" "${INFORMIX_CLIENTSDK_DOWNLOAD_FOLDER}/"
cd "${INFORMIX_CLIENTSDK_DOWNLOAD_FOLDER}/"
[[ ! -d "${INFORMIXDIR}" ]] && ./installclientsdk -i silent -f "%{SOURCE2}"

# extract source0
%setup -q -n PDO_INFORMIX-%{version}

%build
export PHP_RPATH=no
phpize
./configure --prefix="${RPM_BUILD_ROOT}/usr" --with-pdo-informix="%{informixdir}"

make


%install
#%make_install
make install INSTALL_ROOT=%{buildroot}
mkdir -p "%{buildroot}/%{_sysconfdir}/php.d/"

install --mode 644 -vD %{SOURCE3} "${RPM_BUILD_ROOT}%{_sysconfdir}/php.d/pdo_informix.ini"

tree "${RPM_BUILD_ROOT}"


%files
%{_libdir}/php/modules/pdo_informix.so
%{_sysconfdir}/php.d/pdo_informix.ini



%changelog

I'm not so happy with the packaging of the informix csdk, I did a small "hack"
which install 2 rpm files from the INFORMIXDIR and embed them into the final rpm
were I think I should just call the installer script from ${INFORMIXDIR}/gskit/installgskit
via %post section and let the script do it job.

That do you think ?