1 #
   2 # CDDL HEADER START
   3 #
   4 # The contents of this file are subject to the terms of the
   5 # Common Development and Distribution License (the "License").
   6 # You may not use this file except in compliance with the License.
   7 #
   8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 # or http://www.opensolaris.org/os/licensing.
  10 # See the License for the specific language governing permissions
  11 # and limitations under the License.
  12 #
  13 # When distributing Covered Code, include this CDDL HEADER in each
  14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15 # If applicable, add the following below this CDDL HEADER, with the
  16 # fields enclosed by brackets "[]" replaced with your own identifying
  17 # information: Portions Copyright [yyyy] [name of copyright owner]
  18 #
  19 # CDDL HEADER END
  20 #
  21 
  22 #
  23 # Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  24 #
  25 
  26 include ../../make-rules/shared-macros.mk
  27 
  28 COMPONENT_NAME=         zlib
  29 COMPONENT_VERSION=      1.2.8
  30 COMPONENT_PROJECT_URL=  http://www.zlib.net/
  31 COMPONENT_SRC=          $(COMPONENT_NAME)-$(COMPONENT_VERSION)
  32 COMPONENT_ARCHIVE=      $(COMPONENT_SRC).tar.gz
  33 COMPONENT_ARCHIVE_HASH= \
  34     sha256:36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d
  35 COMPONENT_ARCHIVE_URL=  http://downloads.sourceforge.net/project/libpng/zlib/$(COMPONENT_VERSION)/$(COMPONENT_ARCHIVE)
  36 COMPONENT_BUGDB=        library/libz
  37 
  38 TPNO=                   17611
  39 
  40 include $(WS_MAKE_RULES)/prep.mk
  41 include $(WS_MAKE_RULES)/configure.mk
  42 include $(WS_MAKE_RULES)/ips.mk
  43 include $(WS_MAKE_RULES)/lint-libraries.mk
  44 
  45 #
  46 # We want to build hardware specific versions of the longest_match()
  47 # function into our shared library that has been hand optimised to use
  48 # some machine architecture specific instructions. Currently, we are doing
  49 # it for the T4 architecture, but later other architectures may be added.
  50 # This is done by taking advantage of the Solaris 11 linker-editor
  51 # "Symbol Capabilities" feature.  Refer to the section "Creating a Family
  52 # of Symbol Capabilities Functions", under "Identifying Capability
  53 # Requirements" in the "Linker and Libraries Guide"
  54 # (http://docs.oracle.com/cd/E19963-01/html/819-0690/chapter2-13.html#giskh).
  55 CAP_OBJS_sparcv7 += ../../capabilities/sun4v/sparcv7/symcap.o 
  56 CAP_OBJS_sparcv9 += ../../capabilities/sun4v/sparcv9/symcap.o 
  57 $(BUILD_DIR)/%/.built: CAP_OBJS=$(CAP_OBJS_$*)
  58 
  59 # Zlib won't build without cloning. We need also to get rid of default
  60 # Makefile and get our own version of zconf.h to avoid interactions
  61 # between 32 and 64 bit builds.
  62 # Also, the x86 architecture does not require alignment for multi-byte
  63 # loads, so we can define UNALIGNED_OK for x86
  64 ifeq ($(MACH), i386)
  65 COMPONENT_PRE_CONFIGURE_ACTION = ( \
  66         $(CLONEY) $(SOURCE_DIR) $(@D); \
  67         $(RM) $(@D)/Makefile $(@D)/zconf.h; \
  68         $(CP) $(SOURCE_DIR)/zconf.h $(@D) )
  69 CFLAGS_EXTRA = -DUNALIGNED_OK -DORIG_LONGEST_MATCH_GLOBAL
  70 PIC_OBJA=
  71 else
  72 COMPONENT_PRE_CONFIGURE_ACTION = ( \
  73         $(CLONEY) $(SOURCE_DIR) $(@D); \
  74         $(RM) $(@D)/Makefile $(@D)/zconf.h; \
  75         $(CP) $(SOURCE_DIR)/zconf.h $(@D) )
  76 CFLAGS_EXTRA = -DORIG_LONGEST_MATCH_GLOBAL -xinline=%auto,no%longest_match
  77 PIC_OBJA=$(CAP_OBJS)
  78 endif
  79 
  80 # Avoid *.lo.bc from Parfait analyze (see also parfait.patch).
  81 PARFAIT += -X *.lo.bc
  82 
  83 CFLAGS += $(CC_PIC)
  84 
  85 CFLAGS += $(CFLAGS_EXTRA)
  86 
  87 # We need to reset configure options here because zlib is confused with
  88 # CC and CFLAGS definitions as configure parameters.
  89 CONFIGURE_OPTIONS       =  --shared
  90 CONFIGURE_OPTIONS       += --prefix=/usr
  91 CONFIGURE_OPTIONS       += $(CONFIGURE_OPTIONS.$(BITS))
  92 CONFIGURE_OPTIONS.64    += --libdir=/usr/lib/$(MACH64)
  93 
  94 CONFIGURE_ENV += CC="$(CC)"
  95 CONFIGURE_ENV += CFLAGS="$(CFLAGS) -xalias_level=basic -xdepend"
  96 CONFIGURE_ENV += LDSHARED="$(CC) $(CFLAGS) -G"
  97 
  98 # This LDSHARED definitions is forced to get all required options plus
  99 # mapfile for result linking. While the one used with configure is just
 100 # to allow Zlib detect capability of creating shared libraries.
 101 COMPONENT_BUILD_ARGS = LDSHARED="$(CC) $(CFLAGS) -G -h libz.so.1 $(LD_OPTIONS_SO) -M ../../mapfile -L." PIC_OBJA=$(PIC_OBJA)
 102 
 103 $(BUILD_DIR)/sparc%/.built: COMPONENT_PRE_BUILD_ACTION = ( \
 104         cd capabilities; \
 105         $(ENV) SUBDIRS="sun4v" BUILD_ARCH=$* CC=$(CC) $(GMAKE) build )
 106 
 107 COMPONENT_TEST_TARGETS = test
 108 
 109 configure:      $(CONFIGURE_32_and_64)
 110 
 111 build:          $(BUILD_32_and_64)
 112 
 113 install:        $(INSTALL_32_and_64)
 114 
 115 test:           $(TEST_32_and_64)
 116 
 117 clean::
 118         $(RM) -r $(BUILD_DIR) $(PROTO_DIR) capabilities/*/*/*.o capabilities/*/$(MACH32)/*.s
 119 
 120 
 121 REQUIRED_PACKAGES += system/library