jdk/makefiles/CopyFiles.gmk
author cl
Thu, 18 Jul 2013 03:39:39 -0700
changeset 18837 d0545441225e
parent 18297 48432b1bbd63
child 19449 902faa8c77ab
permissions -rw-r--r--
Added tag jdk8-b99 for changeset d104c72ebc8a

#
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

INCLUDEDIR = $(JDK_OUTPUTDIR)/include

OPENJDK_TARGET_OS_INCLUDE = $(INCLUDEDIR)/$(OPENJDK_TARGET_OS)

ifeq ($(OPENJDK_TARGET_OS), windows)
     OPENJDK_TARGET_OS_INCLUDE = $(INCLUDEDIR)/win32
else ifeq ($(OPENJDK_TARGET_OS), macosx)
     OPENJDK_TARGET_OS_INCLUDE = $(INCLUDEDIR)/darwin
endif

#
# Copy exported header files to outputdir.
#
H_TARGET_FILES =$(INCLUDEDIR)/jdwpTransport.h		\
		$(INCLUDEDIR)/jni.h 			\
		$(INCLUDEDIR)/jvmti.h			\
		$(INCLUDEDIR)/jvmticmlr.h		\
		$(INCLUDEDIR)/classfile_constants.h	\
		$(INCLUDEDIR)/jawt.h			\
		$(OPENJDK_TARGET_OS_INCLUDE)/jni_md.h	\
		$(OPENJDK_TARGET_OS_INCLUDE)/jawt_md.h

$(INCLUDEDIR)/%.h: $(JDK_TOPDIR)/src/share/javavm/export/%.h
	$(call install-file)

$(OPENJDK_TARGET_OS_INCLUDE)/%.h: $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export/%.h
	$(call install-file)

COPY_FILES = $(H_TARGET_FILES)

##########################################################################################

ifndef OPENJDK
ifeq ($(OPENJDK_TARGET_OS), windows)
    COPY_FILES += $(OPENJDK_TARGET_OS_INCLUDE)/bridge/AccessBridgeCallbacks.h \
		  $(OPENJDK_TARGET_OS_INCLUDE)/bridge/AccessBridgeCalls.h \
		  $(OPENJDK_TARGET_OS_INCLUDE)/bridge/AccessBridgePackages.h \
		  $(OPENJDK_TARGET_OS_INCLUDE)/bridge/AccessBridgeCalls.c \
		  $(JDK_OUTPUTDIR)/lib/accessibility.properties

    $(OPENJDK_TARGET_OS_INCLUDE)/bridge/%: \
		$(JDK_TOPDIR)/src/closed/windows/native/sun/bridge/%
	$(install-file)

    $(JDK_OUTPUTDIR)/lib/accessibility.properties: \
		$(JDK_TOPDIR)/src/closed/windows/native/sun/bridge/accessibility.properties
	$(install-file)

endif
endif

##########################################################################################

LIBDIR = $(JDK_OUTPUTDIR)/lib

MGMT_LIBDIR = $(LIBDIR)/management
MGMT_LIB_SRC = $(JDK_TOPDIR)/src/share/lib/management
MGMT_SRC_FILES = $(wildcard $(MGMT_LIB_SRC)/*)
MGMT_TARGET_FILES = $(subst $(MGMT_LIB_SRC),$(MGMT_LIBDIR),$(MGMT_SRC_FILES))

$(MGMT_LIBDIR)/management.properties: $(MGMT_LIB_SRC)/management.properties
	$(call install-file)
	$(CHMOD) 644 $@

# this file has different permissions...don't know why...
$(MGMT_LIBDIR)/jmxremote.access: $(MGMT_LIB_SRC)/jmxremote.access
	$(call install-file)
	$(CHMOD) 644 $@

$(MGMT_LIBDIR)/%: $(MGMT_LIB_SRC)/%
	$(call install-file)
	$(CHMOD) 444 $@

COPY_FILES += $(MGMT_TARGET_FILES)

##########################################################################################

LOGGING_LIB_SRC = $(JDK_TOPDIR)/src/share/lib

$(LIBDIR)/logging.properties: $(LOGGING_LIB_SRC)/logging.properties
	$(call install-file)

COPY_FILES += $(LIBDIR)/logging.properties

##########################################################################################
#
# Copy property files from sun/print to LIBDIR
#
PSFONTPROPFILE_SRC_DIR = $(JDK_TOPDIR)/src/share/classes/sun/print
PSFONTPROPFILE_SRCS = $(wildcard $(PSFONTPROPFILE_SRC_DIR)/*.properties*)
PSFONTPROPFILE_TARGET_FILES = $(subst $(PSFONTPROPFILE_SRC_DIR),$(LIBDIR),$(PSFONTPROPFILE_SRCS))

$(LIBDIR)/%: $(PSFONTPROPFILE_SRC_DIR)/%
	$(call install-file)

COPY_FILES += $(PSFONTPROPFILE_TARGET_FILES)

##########################################################################################
#
# Copy flavormap.properties, cursor.properties and cursors gif files to LIBDIR
#
ifneq ($(OPENJDK_TARGET_OS), macosx)
OPENJDK_TARGET_OS_LIB_SRC = $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib
else
OPENJDK_TARGET_OS_LIB_SRC = $(JDK_TOPDIR)/src/macosx/lib
endif

$(LIBDIR)/flavormap.properties: $(OPENJDK_TARGET_OS_LIB_SRC)/flavormap.properties
	$(call install-file)

COPY_FILES += $(LIBDIR)/flavormap.properties

CURSORS_DEST_DIR = $(LIBDIR)/images/cursors
CURSORS_OPENJDK_TARGET_OS_LIB_SRC = $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib/images/cursors

$(CURSORS_DEST_DIR)/cursors.properties: $(CURSORS_OPENJDK_TARGET_OS_LIB_SRC)/cursors.properties
	$(call install-file)

COPY_FILES += $(CURSORS_DEST_DIR)/cursors.properties

CURSORS_LIB_SRC = $(JDK_TOPDIR)/src/share/lib/images/cursors
ifeq ($(OPENJDK_TARGET_OS), windows)
CURSORS_SRC_FILES = $(CURSORS_LIB_SRC)/invalid32x32.gif $(wildcard $(CURSORS_LIB_SRC)/win32_*.gif)
else # OPENJDK_TARGET_OS
CURSORS_SRC_FILES = $(CURSORS_LIB_SRC)/invalid32x32.gif $(wildcard $(CURSORS_LIB_SRC)/motif_*.gif)
endif # OPENJDK_TARGET_OS
CURSORS_TARGET_FILES =  $(subst $(CURSORS_LIB_SRC),$(CURSORS_DEST_DIR),$(CURSORS_SRC_FILES))

$(CURSORS_DEST_DIR)/%: $(CURSORS_LIB_SRC)/%
	$(call install-file)

COPY_FILES += $(CURSORS_TARGET_FILES)

##########################################################################################

CONTENT_TYPES_SRC=$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib

$(LIBDIR)/content-types.properties: $(CONTENT_TYPES_SRC)/content-types.properties
	$(call install-file)

COPY_FILES += $(LIBDIR)/content-types.properties

##########################################################################################

CALENDARS_SRC := $(JDK_TOPDIR)/src/share/lib

$(LIBDIR)/calendars.properties: $(CALENDARS_SRC)/calendars.properties
	$(call install-file)

COPY_FILES += $(LIBDIR)/calendars.properties

$(LIBDIR)/hijrah-config-umalqura.properties: $(CALENDARS_SRC)/hijrah-config-umalqura.properties
	$(MKDIR) -p $(@D)
	$(RM) $@
	$(CP) $< $@

COPY_FILES += $(LIBDIR)/hijrah-config-umalqura.properties

##########################################################################################

ifeq ($(OPENJDK_TARGET_OS),windows)

TZMAPPINGS_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/lib

$(LIBDIR)/tzmappings: $(TZMAPPINGS_SRC)/tzmappings
	$(call install-file)

COPY_FILES += $(LIBDIR)/tzmappings

endif

##########################################################################################

ICCPROFILE_DEST_DIR := $(LIBDIR)/cmm

ifdef OPENJDK
    ICCPROFILE_SRC_DIR := $(JDK_TOPDIR)/src/share/lib/cmm/lcms
else
    ICCPROFILE_SRC_DIR := $(JDK_TOPDIR)/src/closed/share/lib/cmm/kcms
endif

ICCPROFILE_SRCS:=$(wildcard $(ICCPROFILE_SRC_DIR)/*.pf)
ICCPROFILE_TARGET_FILES:=$(subst $(ICCPROFILE_SRC_DIR),$(ICCPROFILE_DEST_DIR),$(ICCPROFILE_SRCS))

$(ICCPROFILE_DEST_DIR)%.pf: $(ICCPROFILE_SRC_DIR)%.pf
	$(call install-file)
	$(CHMOD) 444 $@

COPY_FILES += $(ICCPROFILE_TARGET_FILES)

##########################################################################################

#make sure freetype dll will be available at runtime as well as link time
#
#NB: Default freetype build system uses -h linker option and
#   result .so contains hardcoded library name that is later
#   used for adding dependencies to other objects
#   (e.g. libfontmanager.so).
#
#   It is not obvious how to extract that hardcoded name (libfreetype.so.6)
#   without overcomplicating logic here.
#   To workaround this we hardcode .6 suffix for now.
#
#   Note that .so.6 library will not be found by System.loadLibrary()
#        but fortunately we need to load FreeType library explicitly
#        on windows only
#
#TODO: rework this to avoid hardcoding library name in the makefile
#
ifdef OPENJDK
    ifeq ($(OPENJDK_TARGET_OS), windows)
        FREETYPE_LIB = $(JDK_OUTPUTDIR)/bin/$(call SHARED_LIBRARY,freetype)
    else
        ifeq ($(USING_SYSTEM_FT_LIB), false)
            FREETYPE_LIB = $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/$(call SHARED_LIBRARY,freetype).6
        endif
    endif

    $(FREETYPE_LIB): $(FREETYPE2_LIB_PATH)/$(call SHARED_LIBRARY,freetype)
	$(CP) $(FREETYPE2_LIB_PATH)/$(call SHARED_LIBRARY,freetype) $@
    ifeq ($(OPENJDK_BUILD_OS), windows)
	$(CHMOD) +rx $@
    endif

    COPY_FILES += $(FREETYPE_LIB)
endif

##########################################################################################

# Copy msvcrXX.dll on windows

ifeq ($(OPENJDK_TARGET_OS),windows)
    MSVCR_TARGET := $(JDK_OUTPUTDIR)/bin/$(notdir $(MSVCR_DLL))
    # Chmod to avoid permission issues if bundles are unpacked on unix platforms.
    $(MSVCR_TARGET): $(MSVCR_DLL)
	$(call install-file)
	$(CHMOD) a+rx $@

    COPY_FILES += $(MSVCR_TARGET)
endif

##########################################################################################

HPROF_SRC=$(JDK_TOPDIR)/src/share/demo/jvmti/hprof/jvm.hprof.txt

$(LIBDIR)/jvm.hprof.txt : $(HPROF_SRC)
	$(call install-file)

COPY_FILES += $(LIBDIR)/jvm.hprof.txt

##########################################################################################

#
# How to install jvm.cfg.
#
ifeq ($(JVM_VARIANT_ZERO), true)
    JVMCFG_ARCH := zero
else
    JVMCFG_ARCH := $(OPENJDK_TARGET_CPU_LEGACY)
endif

ifeq ($(OPENJDK_TARGET_OS),macosx)
  JVMCFG_SRC := $(JDK_TOPDIR)/src/macosx/bin/$(JVMCFG_ARCH)/jvm.cfg
else
  JVMCFG_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/$(JVMCFG_ARCH)/jvm.cfg
endif
JVMCFG_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
JVMCFG := $(JVMCFG_DIR)/jvm.cfg


ifeq ($(OPENJDK_TARGET_CPU_BITS),32)
  # On 32-bit machines we have three potential VMs: client, server and minimal.
  # Historically we usually have both client and server and so that is what the
  # committed jvm.cfg expects (including platform specific ergonomics switches
  # to decide whether to use client or server by default). So when we have anything
  # other than client and server we need to define a new jvm.cfg file.
  # The main problem is deciding whether to use aliases for the VMs that are not
  # present and the current position is that we add aliases for client and server, but
  # not for minimal.
  # To do: should this also support, -zero and -zeroshark?

  CLIENT_AND_SERVER := $(and $(findstring true,$(JVM_VARIANT_SERVER)),$(findstring true,$(JVM_VARIANT_CLIENT)))

  ifeq ($(CLIENT_AND_SERVER), true)
    # Use the committed jvm.cfg for this 32 bit setup (the minimal
    # VM is already KNOWN on platforms that potentially support it)
    $(JVMCFG): $(JVMCFG_SRC)
	$(call install-file)
  else
    $(JVMCFG):
	$(MKDIR) -p $(@D)
	$(RM) $(@)

    # Now check for other permutations
    ifeq ($(JVM_VARIANT_SERVER), true)
	$(PRINTF) "-server KNOWN\n">>$(@)
	$(PRINTF) "-client ALIASED_TO -server\n">>$(@)
        ifeq ($(JVM_VARIANT_MINIMAL1), true)
	    $(PRINTF) "-minimal KNOWN\n">>$(@)
        endif
    else
        ifeq ($(JVM_VARIANT_CLIENT), true)
	    $(PRINTF) "-client KNOWN\n">>$(@)
	    $(PRINTF) "-server ALIASED_TO -client\n">>$(@)
            ifeq ($(JVM_VARIANT_MINIMAL1), true)
	        $(PRINTF) "-minimal KNOWN\n">>$(@)
            endif
        else
            ifeq ($(JVM_VARIANT_MINIMAL1), true)
	        $(PRINTF) "-minimal KNOWN\n">>$(@)
	        $(PRINTF) "-server ALIASED_TO -minimal\n">>$(@)
	        $(PRINTF) "-client ALIASED_TO -minimal\n">>$(@)
            endif
        endif
    endif
  endif

else
    # Use the default jvm.cfg for this 64 bit setup.
    $(JVMCFG): $(JVMCFG_SRC)
	$(call install-file)
endif

COPY_FILES += $(JVMCFG)

##########################################################################################

PROPS_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.security-$(OPENJDK_TARGET_OS)
PROPS_DST := $(JDK_OUTPUTDIR)/lib/security/java.security

$(PROPS_DST): $(PROPS_SRC)
	$(call install-file)

COPY_FILES += $(PROPS_DST)

##########################################################################################

POLICY_SRC := $(JDK_TOPDIR)/src/share/lib/security/java.policy
POLICY_DST := $(JDK_OUTPUTDIR)/lib/security/java.policy

$(POLICY_DST): $(POLICY_SRC)
	$(call install-file)

COPY_FILES += $(POLICY_DST)

##########################################################################################

CACERTS_SRC := $(CACERTS_FILE)
CACERTS_DST := $(JDK_OUTPUTDIR)/lib/security/cacerts

$(CACERTS_DST): $(CACERTS_SRC)
	$(call install-file)

COPY_FILES += $(CACERTS_DST)

##########################################################################################

ifndef OPENJDK

BLACKLIST_SRC   := $(JDK_TOPDIR)/src/closed/share/lib/security/blacklist
BLACKLIST_DST   := $(JDK_OUTPUTDIR)/lib/security/blacklist

TRUSTEDLIBS_SRC := $(JDK_TOPDIR)/src/closed/share/lib/security/trusted.libraries
TRUSTEDLIBS_DST := $(JDK_OUTPUTDIR)/lib/security/trusted.libraries

$(BLACKLIST_DST): $(BLACKLIST_SRC)
	$(call install-file)

COPY_FILES += $(BLACKLIST_DST)

$(TRUSTEDLIBS_DST): $(TRUSTEDLIBS_SRC)
	$(call install-file)

COPY_FILES += $(TRUSTEDLIBS_DST)

endif

##########################################################################################

ifndef OPENJDK

SHARED_FONTS_SRC_DIR := $(JDK_TOPDIR)/src/closed/share/lib/fonts
SHARED_FONTS_DST_DIR := $(JDK_OUTPUTDIR)/lib/fonts
SHARED_FONTS_FILES   := \
	LucidaTypewriterRegular.ttf	\
	LucidaTypewriterBold.ttf        \
	LucidaBrightRegular.ttf         \
	LucidaBrightDemiBold.ttf        \
	LucidaBrightItalic.ttf          \
	LucidaBrightDemiItalic.ttf	\
	LucidaSansRegular.ttf       	\
	LucidaSansDemiBold.ttf       	\

SHARED_FONTS_SRC := $(foreach F,$(SHARED_FONTS_FILES),$(SHARED_FONTS_SRC_DIR)/$(F))
SHARED_FONTS_DST := $(foreach F,$(SHARED_FONTS_FILES),$(SHARED_FONTS_DST_DIR)/$(F))

$(SHARED_FONTS_DST_DIR)/%.ttf : $(SHARED_FONTS_SRC_DIR)/%.ttf
	$(call install-file)

$(SHARED_FONTS_DST_DIR)/fonts.dir : $(JDK_TOPDIR)/src/solaris/classes/sun/awt/motif/java.fonts.dir
	$(call install-file)

COPY_FILES += $(SHARED_FONTS_DST)

ifneq ($(OPENJDK_TARGET_OS), windows)
    COPY_FILES += $(SHARED_FONTS_DST_DIR)/fonts.dir
endif

ifeq ($(OPENJDK_TARGET_OS), linux)

# The oblique fonts are only needed/wanted on Linux.

OBL_FONTS_SRC_DIR := $(JDK_TOPDIR)/src/closed/share/lib/fonts/oblique
OBL_FONTS_DST_DIR := $(JDK_OUTPUTDIR)/lib/oblique-fonts
OBL_FONTS_FILES   := LucidaTypewriterOblique.ttf LucidaTypewriterBoldOblique.ttf \
                    LucidaSansOblique.ttf LucidaSansDemiOblique.ttf

OBL_FONTS_SRC := $(foreach F,$(OBL_FONTS_FILES),$(OBL_FONTS_SRC_DIR)/$(F))
OBL_FONTS_DST := $(foreach F,$(OBL_FONTS_FILES),$(OBL_FONTS_DST_DIR)/$(F))

$(OBL_FONTS_DST_DIR)/%.ttf : $(OBL_FONTS_SRC_DIR)/%.ttf
	$(call install-file)

$(OBL_FONTS_DST_DIR)/fonts.dir : $(JDK_TOPDIR)/src/solaris/classes/sun/awt/motif/java.oblique-fonts.dir
	$(call install-file)

COPY_FILES += $(OBL_FONTS_DST) $(OBL_FONTS_DST_DIR)/fonts.dir

endif # linux
endif # OPENJDK

##########################################################################################

ifndef OPENJDK

#
# Solaris X11 Direct Graphics Access library
#

_DGALIBS_sparc = \
	libxinerama.so \
	libjdgaSUNWcg6.so \
	libjdgaSUNWffb.so \
	libjdgaSUNWm64.so \
	libjdgaSUNWafb.so

_DGALIBS_sparcv9 = \
	libxinerama.so \
	libjdgaSUNWcg6.so \
	libjdgaSUNWffb.so \
	libjdgaSUNWm64.so \
	libjdgaSUNWafb.so

_DGALIBS_i586 = 	# no i586 library yet

_DGALIBS_amd64 = 	# no amd64 library yet

DGALIBS = $(_DGALIBS_$(OPENJDK_TARGET_CPU_LEGACY):%=$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/%)

$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libxinerama.so: $(JDK_TOPDIR)/src/closed/solaris/lib/$(OPENJDK_TARGET_CPU_LEGACY)/libxinerama.so
	$(call install-file)
	$(CHMOD) 755 $@

$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjdgaSUNW%.so: $(JDK_TOPDIR)/src/closed/solaris/lib/$(OPENJDK_TARGET_CPU_LEGACY)/libjdgaSUNW%.so
	$(call install-file)
	$(CHMOD) 755 $@

$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjdgaSUNWafb.so: $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjdgaSUNWffb.so
	$(MKDIR) -p $(@D)
	$(RM) $@
	$(LN) -s $(<F) $@

COPY_FILES += $(DGALIBS)

endif

##########################################################################################

ifeq ($(OPENJDK_TARGET_OS), solaris)

SUNPKCS11_CFG_SRC := $(JDK_TOPDIR)/src/share/lib/security/sunpkcs11-solaris.cfg
SUNPKCS11_CFG_DST := $(JDK_OUTPUTDIR)/lib/security/sunpkcs11-solaris.cfg

$(SUNPKCS11_CFG_DST) : $(SUNPKCS11_CFG_SRC)
	$(call install-file)

COPY_FILES += $(SUNPKCS11_CFG_DST)

endif

##########################################################################################

ifndef OPENJDK
ifeq ($(OPENJDK_TARGET_OS), solaris)

UCRYPTO_CFG_SRC := $(JDK_TOPDIR)/src/closed/share/lib/security/ucrypto-solaris.cfg
UCRYPTO_CFG_DST := $(JDK_OUTPUTDIR)/lib/security/ucrypto-solaris.cfg

$(UCRYPTO_CFG_DST) : $(UCRYPTO_CFG_SRC)
	$(call install-file)

COPY_FILES += $(UCRYPTO_CFG_DST)

endif
endif

##########################################################################################

$(JDK_OUTPUTDIR)/lib/sound.properties : $(JDK_TOPDIR)/src/share/lib/sound.properties
	$(call install-file)

COPY_FILES += $(JDK_OUTPUTDIR)/lib/sound.properties

##########################################################################################

-include $(CUSTOM_MAKE_DIR)/CopyFiles.gmk