#!/usr/bin/make -f

# See debhelper(7) (uncomment to enable).
# Output every command that modifies files on the build system.

include /usr/share/dpkg/architecture.mk

ifeq ($(DEB_HOST_ARCH),amd64)
export instantclientdir = instantclient-linux-x86_64
export ARCH = 64
else
export instantclientdir = instantclient-linux_i386
export ARCH =
endif

export LIB_VERSION = 19.6

DESTDIR = $(CURDIR)/debian/oracle-instantclient-basic

#export DH_VERBOSE = 1


# See FEATURE AREAS in dpkg-buildflags(1).
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# See ENVIRONMENT in dpkg-buildflags(1).
# Package maintainers to append CFLAGS.
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# Package maintainers to append LDFLAGS.
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed


%:
	dh $@


# dh_make generated override targets.
# This is an example for Cmake (see <https://bugs.debian.org/641051>).
#override_dh_auto_configure:
#	dh_auto_configure -- \
#	-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

execute_after_dh_install:
	$(shell (echo "/usr/lib/oracle/$(LIB_VERSION)/client$(ARCH)/lib/" >$(DESTDIR)/etc/ld.so.conf.d/oracle.conf))
	# remove symlink for libclntsh.so and libocci.so:
	# it's provided by oracle-instantclient$(LIB_VERSION)-devel
	rm -v $(DESTDIR)/usr/lib/oracle/$(LIB_VERSION)/client$(ARCH)/lib/libclntsh.so
	rm -v $(DESTDIR)/usr/lib/oracle/$(LIB_VERSION)/client$(ARCH)/lib/libocci.so

override_dh_dwz:
	# don't run tools on binaries files. We just want to install the
	# upstream binaries files

override_dh_shlibdeps:
	dh_shlibdeps -l$(DESTDIR)/usr/lib/oracle/$(LIB_VERSION)/client$(ARCH)/lib