Makefile revision 6532
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest#
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# CDDL HEADER START
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest#
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# The contents of this file are subject to the terms of the
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# Common Development and Distribution License (the "License").
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# You may not use this file except in compliance with the License.
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest#
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# or http://www.opensolaris.org/os/licensing.
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# See the License for the specific language governing permissions
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# and limitations under the License.
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest#
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# When distributing Covered Code, include this CDDL HEADER in each
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# If applicable, add the following below this CDDL HEADER, with the
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# fields enclosed by brackets "[]" replaced with your own identifying
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# information: Portions Copyright [yyyy] [name of copyright owner]
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest#
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# CDDL HEADER END
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest#
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest#
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest#
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# This variable has no impact on perl build, it is here merely to satisfy
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# "modernized" gate infrastructure. The bitness of the module is driven by the
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# bitness of perl interpreter itself. That is hardcoded in
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# $(WS_MAKE_RULES)/makemaker.mk
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestBUILD_BITS = 64
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrestinclude ../../../make-rules/shared-macros.mk
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest
3d8ee1629200b24b539b887a7feaec640fe610a8Kajetan HemzaczekCOMPONENT_NAME= DBD-mysql
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestCOMPONENT_VERSION= 4.035
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestIPS_COMPONENT_VERSION= 4035
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestHUMAN_VERSION= $(COMPONENT_VERSION)
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestCOMPONENT_ARCHIVE_HASH= \
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest sha256:b7eca365ea16bcf4c96c2fc0221304ff9c4995e7a551886837804a8f66b61937
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestCOMPONENT_ARCHIVE_URL= http://search.cpan.org/CPAN/authors/id/M/MI/MICHIELB/$(COMPONENT_ARCHIVE)
3d8ee1629200b24b539b887a7feaec640fe610a8Kajetan HemzaczekCOMPONENT_PROJECT_URL= https://github.com/perl5-dbi/DBD-mysql
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestCOMPONENT_BUGDB= perl-mod/dbd-mysql
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestTPNO= 30300
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestBUILD_STYLE= makemaker
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestLICENSE=DBD-mysql.license
3d8ee1629200b24b539b887a7feaec640fe610a8Kajetan HemzaczekBUILD_TARGET= $(BUILD_$(MK_BITS)) $(LICENSE)
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrestinclude $(WS_MAKE_RULES)/common.mk
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestCLEAN_PATHS += $(LICENSE)
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestCOMPONENT_TEST_TARGETS = test
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestCOMPONENT_TEST_MASTER = $(COMPONENT_TEST_RESULTS_DIR)/results-all.master
3d8ee1629200b24b539b887a7feaec640fe610a8Kajetan HemzaczekCOMPONENT_TEST_TRANSFORMS += \
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest '-e "s/[0-9][0-9]* wallclock secs (.*CPU)$$/<TIMINGS REMOVED>/" ' \
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest '-e "s/^\(\# mysql_[a-z][a-z]* is: \).*/\1<REMOVED>/" ' \
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest '-e "s/^\(\# SQL_DBMS_VER is \).*/\1<REMOVED>/" ' \
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest '-e "s/^\(\# Driver version is \).*/\1<REMOVED>/" ' \
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest '-e "/chmod 644 \"mysql.bs\"/d"' \
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest '-e "/Running Mkbootstrap/d"'
3d8ee1629200b24b539b887a7feaec640fe610a8Kajetan Hemzaczek
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestASLR_MODE = $(ASLR_NOT_APPLICABLE)
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestMYSQL_VERSION = 5.6
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestMYSQL_BINDIR = $(USRDIR)/mysql/$(MYSQL_VERSION)/bin
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestMYSQL_TEST_USER = root
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestMYSQL_TEST_PASSWORD = new-password
3d8ee1629200b24b539b887a7feaec640fe610a8Kajetan HemzaczekMYSQL_TEST_DATADIR = $(COMPONENT_TEST_BUILD_DIR)/test_datadir
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestCOMPONENT_TEST_ENV += MYSQL_HISTFILE=/dev/null
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestCONFIGURE_OPTIONS += --mysql_config="$(MYSQL_BINDIR)/mysql_config"
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestCONFIGURE_OPTIONS += --testuser=$(MYSQL_TEST_USER)
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestCONFIGURE_OPTIONS += --testpassword=$(MYSQL_TEST_PASSWORD)
3d8ee1629200b24b539b887a7feaec640fe610a8Kajetan HemzaczekCONFIGURE_OPTIONS += --testsocket=CHANGEME
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# !!!!!!!!! workaround for 22552923
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestMYSQL_LIBS = $(shell $(MYSQL_BINDIR)/mysql_config --libs)
74478f22726009d623b143d2b017f2e3a0884916Andrew ForrestCONFIGURE_OPTIONS += --libs="$(MYSQL_LIBS) -lCrun"
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# !!!!!!!!! workaround for 22552923
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# For the testing we need to run mysql database first. The database needs it's
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# directory, which will be $(MYSQL_TEST_DATADIR). The directory will also
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# contain socket over which the testing will be performed. Problem is that the
74478f22726009d623b143d2b017f2e3a0884916Andrew Forrest# path can be maximally 107 characters long. To overcome that limit, we'll
# create a symlink in /tmp pointing to the directory and refer the database to
# that symlink. The symlink must have random name, so that multiple tests may
# be executed simultaneously. Problem is that we have to specify the symlink
# name during configure. To overcome that I specify the socket name as
# 'CHANGEME' and "fix" the tests once I know the name of symlink.
# Second challenge is to make sure that the mysql daemon will be stopped once
# the tests end (finish or are interrupted). There are three mechanisms to do
# that.
# a) mysql stores it's pid to $(MYSQL_TEST_DATADIR)/pid
# b) the COMPONENT_PRE_TEST_ACTION runs a background task which kills the
# daemon in 10 minutes no matter what.
# c) the COMPONENT_POST_TEST_ACTION kills both the mysql daemon and the
# background task
# If you want to keep mysqld running for your own testing purposes, delete all
# the lines containing 'kill' in COMPONENT_PRE_TEST_ACTION and
# COMPONENT_POST_TEST_ACTION. Then run "gmake test" once which will both run
# the DB and configure the module to use it. After that you can "cd builds/..."
# and "gmake test" directly there.
# Normally the noise from background jobs is sent to /dev/null so that it does
# not clobber the terminal. For debugging you can leave SILENT empty which will
# even turn on more output
SILENT = >/dev/null 2>&1
ifeq ($(strip $(SILENT)),)
SET_X = set -x;
MYSQLD_VERBOSE =
else
SET_X =
MYSQLD_VERBOSE = --verbose
endif
COMPONENT_PRE_TEST_ACTION = ( \
$(SET_X) cd "$(@D)"; \
\
: "Prepare the testing directory and create the symlink to it"; \
$(RM) -r "$(MYSQL_TEST_DATADIR)"; \
mkdir "$(MYSQL_TEST_DATADIR)"; \
TEST_LINK=`mktemp -t dbd-mysql-test.XXXXXX`; \
$(RM) "$$TEST_LINK"; \
ln -s $(MYSQL_TEST_DATADIR) "$$TEST_LINK"; \
echo "$$TEST_LINK" > "$$TEST_LINK"/test_link; \
\
: "alter the tests to use the path we just created"; \
$(PERL) -pi -e "s,('testsocket' => ').*?',\$$1/$$TEST_LINK/socket'," t/mysql.mtest ;\
\
: "Initialize mysql DB"; \
"$(MYSQL_BINDIR)/mysql_install_db" \
--keep-my-cnf \
--datadir="$$TEST_LINK" \
--basedir=/usr/mysql/$(MYSQL_VERSION) $(SILENT) ; \
\
: "Run the daemon in background. --gdb makes it possible to terminate mysqld via Ctrl+C"; \
"$(MYSQL_BINDIR)/mysqld" \
$(MYSQLD_VERBOSE) \
--skip-networking \
--datadir="$$TEST_LINK" \
--socket="$$TEST_LINK"/socket \
--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