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