Makefile revision 6532
2818N/A#
2818N/A# CDDL HEADER START
2818N/A#
2818N/A# The contents of this file are subject to the terms of the
2818N/A# Common Development and Distribution License (the "License").
2818N/A# You may not use this file except in compliance with the License.
2818N/A#
2818N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2818N/A# or http://www.opensolaris.org/os/licensing.
2818N/A# See the License for the specific language governing permissions
2818N/A# and limitations under the License.
2818N/A#
2818N/A# When distributing Covered Code, include this CDDL HEADER in each
2818N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2818N/A# If applicable, add the following below this CDDL HEADER, with the
2818N/A# fields enclosed by brackets "[]" replaced with your own identifying
2818N/A# information: Portions Copyright [yyyy] [name of copyright owner]
2818N/A#
2818N/A# CDDL HEADER END
2818N/A#
2818N/A
2818N/A#
2818N/A# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
2818N/A#
2818N/A
2818N/A# This variable has no impact on perl build, it is here merely to satisfy
2818N/A# "modernized" gate infrastructure. The bitness of the module is driven by the
2818N/A# bitness of perl interpreter itself. That is hardcoded in
2818N/A# $(WS_MAKE_RULES)/makemaker.mk
2818N/ABUILD_BITS = 64
2818N/A
2818N/Ainclude ../../../make-rules/shared-macros.mk
2818N/A
2818N/ACOMPONENT_NAME= DBD-mysql
2818N/ACOMPONENT_VERSION= 4.035
2818N/AIPS_COMPONENT_VERSION= 4035
2818N/AHUMAN_VERSION= $(COMPONENT_VERSION)
2818N/ACOMPONENT_ARCHIVE_HASH= \
2818N/A sha256:b7eca365ea16bcf4c96c2fc0221304ff9c4995e7a551886837804a8f66b61937
2818N/ACOMPONENT_ARCHIVE_URL= http://search.cpan.org/CPAN/authors/id/M/MI/MICHIELB/$(COMPONENT_ARCHIVE)
2818N/ACOMPONENT_PROJECT_URL= https://github.com/perl5-dbi/DBD-mysql
2818N/ACOMPONENT_BUGDB= perl-mod/dbd-mysql
2818N/A
2818N/ATPNO= 30300
2818N/A
2818N/ABUILD_STYLE= makemaker
2818N/ALICENSE=DBD-mysql.license
2818N/ABUILD_TARGET= $(BUILD_$(MK_BITS)) $(LICENSE)
2818N/Ainclude $(WS_MAKE_RULES)/common.mk
2818N/A
2818N/ACLEAN_PATHS += $(LICENSE)
2818N/A
2818N/ACOMPONENT_TEST_TARGETS = test
2818N/ACOMPONENT_TEST_MASTER = $(COMPONENT_TEST_RESULTS_DIR)/results-all.master
2818N/ACOMPONENT_TEST_TRANSFORMS += \
2818N/A '-e "s/[0-9][0-9]* wallclock secs (.*CPU)$$/<TIMINGS REMOVED>/" ' \
2818N/A '-e "s/^\(\# mysql_[a-z][a-z]* is: \).*/\1<REMOVED>/" ' \
2818N/A '-e "s/^\(\# SQL_DBMS_VER is \).*/\1<REMOVED>/" ' \
2818N/A '-e "s/^\(\# Driver version is \).*/\1<REMOVED>/" ' \
2818N/A '-e "/chmod 644 \"mysql.bs\"/d"' \
2818N/A '-e "/Running Mkbootstrap/d"'
2818N/A
2818N/AASLR_MODE = $(ASLR_NOT_APPLICABLE)
2818N/A
2818N/AMYSQL_VERSION = 5.6
2818N/AMYSQL_BINDIR = $(USRDIR)/mysql/$(MYSQL_VERSION)/bin
2818N/AMYSQL_TEST_USER = root
2818N/AMYSQL_TEST_PASSWORD = new-password
2818N/AMYSQL_TEST_DATADIR = $(COMPONENT_TEST_BUILD_DIR)/test_datadir
2818N/A
2818N/ACOMPONENT_TEST_ENV += MYSQL_HISTFILE=/dev/null
2818N/A
2818N/ACONFIGURE_OPTIONS += --mysql_config="$(MYSQL_BINDIR)/mysql_config"
2818N/ACONFIGURE_OPTIONS += --testuser=$(MYSQL_TEST_USER)
2818N/ACONFIGURE_OPTIONS += --testpassword=$(MYSQL_TEST_PASSWORD)
2818N/ACONFIGURE_OPTIONS += --testsocket=CHANGEME
2818N/A
2818N/A# !!!!!!!!! workaround for 22552923
2818N/AMYSQL_LIBS = $(shell $(MYSQL_BINDIR)/mysql_config --libs)
2818N/ACONFIGURE_OPTIONS += --libs="$(MYSQL_LIBS) -lCrun"
2818N/A# !!!!!!!!! workaround for 22552923
2818N/A
2818N/A# For the testing we need to run mysql database first. The database needs it's
2818N/A# directory, which will be $(MYSQL_TEST_DATADIR). The directory will also
2818N/A# contain socket over which the testing will be performed. Problem is that the
2818N/A# path can be maximally 107 characters long. To overcome that limit, we'll
2818N/A# create a symlink in /tmp pointing to the directory and refer the database to
2818N/A# that symlink. The symlink must have random name, so that multiple tests may
2818N/A# be executed simultaneously. Problem is that we have to specify the symlink
2818N/A# name during configure. To overcome that I specify the socket name as
2818N/A# 'CHANGEME' and "fix" the tests once I know the name of symlink.
2818N/A
2818N/A# Second challenge is to make sure that the mysql daemon will be stopped once
2818N/A# the tests end (finish or are interrupted). There are three mechanisms to do
2818N/A# that.
2818N/A# a) mysql stores it's pid to $(MYSQL_TEST_DATADIR)/pid
2818N/A# b) the COMPONENT_PRE_TEST_ACTION runs a background task which kills the
2818N/A# daemon in 10 minutes no matter what.
2818N/A# c) the COMPONENT_POST_TEST_ACTION kills both the mysql daemon and the
2818N/A# background task
2818N/A
2818N/A# If you want to keep mysqld running for your own testing purposes, delete all
2818N/A# the lines containing 'kill' in COMPONENT_PRE_TEST_ACTION and
2818N/A# COMPONENT_POST_TEST_ACTION. Then run "gmake test" once which will both run
2818N/A# the DB and configure the module to use it. After that you can "cd builds/..."
2818N/A# and "gmake test" directly there.
2818N/A
2818N/A# Normally the noise from background jobs is sent to /dev/null so that it does
2818N/A# not clobber the terminal. For debugging you can leave SILENT empty which will
2818N/A# even turn on more output
2818N/ASILENT = >/dev/null 2>&1
2818N/Aifeq ($(strip $(SILENT)),)
2818N/ASET_X = set -x;
2818N/AMYSQLD_VERBOSE =
2818N/Aelse
2818N/ASET_X =
2818N/AMYSQLD_VERBOSE = --verbose
2818N/Aendif
2818N/A
2818N/ACOMPONENT_PRE_TEST_ACTION = ( \
2818N/A $(SET_X) cd "$(@D)"; \
2818N/A \
2818N/A : "Prepare the testing directory and create the symlink to it"; \
2818N/A $(RM) -r "$(MYSQL_TEST_DATADIR)"; \
2818N/A mkdir "$(MYSQL_TEST_DATADIR)"; \
2818N/A TEST_LINK=`mktemp -t dbd-mysql-test.XXXXXX`; \
2818N/A $(RM) "$$TEST_LINK"; \
2818N/A ln -s $(MYSQL_TEST_DATADIR) "$$TEST_LINK"; \
2818N/A echo "$$TEST_LINK" > "$$TEST_LINK"/test_link; \
2818N/A \
2818N/A : "alter the tests to use the path we just created"; \
2818N/A $(PERL) -pi -e "s,('testsocket' => ').*?',\$$1/$$TEST_LINK/socket'," t/mysql.mtest ;\
2818N/A \
2818N/A : "Initialize mysql DB"; \
2818N/A "$(MYSQL_BINDIR)/mysql_install_db" \
2818N/A --keep-my-cnf \
2818N/A --datadir="$$TEST_LINK" \
2818N/A --basedir=/usr/mysql/$(MYSQL_VERSION) $(SILENT) ; \
2818N/A \
2818N/A : "Run the daemon in background. --gdb makes it possible to terminate mysqld via Ctrl+C"; \
2818N/A "$(MYSQL_BINDIR)/mysqld" \
2818N/A $(MYSQLD_VERBOSE) \
2818N/A --skip-networking \
2818N/A --datadir="$$TEST_LINK" \
2818N/A --socket="$$TEST_LINK"/socket \
2818N/A --pid-file="$$TEST_LINK"/pid \
--gdb \
--log-warnings=0 \
$(SILENT) & \
: "Now wait for the database to be online"; \
sleep 10; \
if [ ! -e "$$TEST_LINK/socket" ]; then \
: "We were not able to bring up the database?"; \
PID=`cat "$$TEST_LINK"/pid`; \
ps -p $$PID && kill $$PID || : \
$(RM) "$$TEST_LINK"; \
exit 1; \
fi; \
\
: "Set admin password"; \
"$(MYSQL_BINDIR)/mysqladmin" \
--socket "$$TEST_LINK"/socket \
-u "$(MYSQL_TEST_USER)" \
password "$(MYSQL_TEST_PASSWORD)" ; \
\
: "Run job which will kill mysqld in 10 minutes"; \
( $(SET_X) PID=`cat "$$TEST_LINK"/pid`; sleep 600; ps -p $$PID && kill $$PID || : ) $(SILENT) & \
echo $$! > "$$TEST_LINK"/pid_of_guard; \
)
COMPONENT_POST_TEST_ACTION = ( \
( $(SET_X) PID=`cat $(MYSQL_TEST_DATADIR)/pid`; [ -n "$$PID" ] && ps -p $$PID && kill $$PID || : ) $(SILENT); \
( $(SET_X) PID=`cat $(MYSQL_TEST_DATADIR)/pid_of_guard`; [ -n "$$PID" ] && ps -p $$PID && kill $$PID || : ) $(SILENT); \
( $(SET_X) if [ -e "$(MYSQL_TEST_DATADIR)/test_link" ]; then rm -f `cat "$(MYSQL_TEST_DATADIR)/test_link"`; fi ) $(SILENT); \
)
$(LICENSE): $(LICENSE).template
$(PERL) -pe 's/COMPONENT_VERSION/$(COMPONENT_VERSION)/g' "$<" > "$@"
REQUIRED_PACKAGES += database/mysql-56/library
REQUIRED_PACKAGES += library/perl-5/database
REQUIRED_PACKAGES += system/library/c++-runtime