8200229: Simplify building of libjsig
authorihse
Mon, 26 Mar 2018 20:44:32 +0200
changeset 49423 fd608d605e2f
parent 49422 b64cd942ac7a
child 49424 4269e701448e
8200229: Simplify building of libjsig Reviewed-by: erikj
make/Main.gmk
make/hotspot/lib/CompileLibjsig.gmk
make/lib/Lib-java.base.gmk
--- a/make/Main.gmk	Mon Mar 26 20:20:45 2018 +0200
+++ b/make/Main.gmk	Mon Mar 26 20:44:32 2018 +0200
@@ -266,14 +266,11 @@
 
 $(foreach v, $(JVM_VARIANTS), $(eval $(call DeclareHotspotLibsRecipe,$v)))
 
-hotspot-jsig:
-	+($(CD) $(TOPDIR)/make/hotspot && $(MAKE) $(MAKE_ARGS) -f lib/CompileLibjsig.gmk)
-
 hotspot-ide-project:
 	+($(CD) $(TOPDIR)/make/hotspot && $(MAKE) $(MAKE_ARGS) -f ide/CreateVSProject.gmk)
 
 ALL_TARGETS += $(HOTSPOT_VARIANT_TARGETS) $(HOTSPOT_VARIANT_GENSRC_TARGETS) \
-    $(HOTSPOT_VARIANT_LIBS_TARGETS) hotspot-jsig hotspot-ide-project
+    $(HOTSPOT_VARIANT_LIBS_TARGETS) hotspot-ide-project
 
 ################################################################################
 # Build demos targets
@@ -909,9 +906,7 @@
 buildtools: buildtools-langtools interim-langtools interim-rmic \
     buildtools-jdk $(JVM_TOOLS_TARGETS)
 
-hotspot: $(HOTSPOT_VARIANT_TARGETS) hotspot-jsig
-
-hotspot-libs: hotspot-jsig
+hotspot: $(HOTSPOT_VARIANT_TARGETS)
 
 # Create targets hotspot-libs and hotspot-gensrc.
 $(foreach v, $(JVM_VARIANTS), \
--- a/make/hotspot/lib/CompileLibjsig.gmk	Mon Mar 26 20:20:45 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +0,0 @@
-#
-# Copyright (c) 2013, 2018, 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.
-#
-
-################################################################################
-# Create the libjsig.so shared library
-
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-include NativeCompilation.gmk
-
-ifneq ($(OPENJDK_TARGET_OS), windows)
-  ifeq ($(STATIC_BUILD), false)
-    ifeq ($(OPENJDK_TARGET_OS), linux)
-      LIBJSIG_CFLAGS := -fPIC -D_GNU_SOURCE -D_REENTRANT $(EXTRA_CFLAGS)
-      LIBJSIG_LDFLAGS := $(LIBJSIG_HASHSTYLE_LDFLAGS) ${LIBJSIG_NOEXECSTACK_LDFLAGS} $(EXTRA_CFLAGS)
-      LIBJSIG_LIBS := $(LIBDL)
-
-      # NOTE: The old build compiled this library without -soname.
-      # To emulate this, we need to clear out SET_SHARED_LIBRARY_NAME.
-      SET_SHARED_LIBRARY_NAME :=
-
-      # Flags for other CPUs can be provided in EXTRA_CFLAGS
-      ifeq ($(OPENJDK_TARGET_CPU), x86_64)
-        LIBJSIG_CPU_FLAGS := -m64
-      else ifeq ($(OPENJDK_TARGET_CPU), x86)
-        LIBJSIG_CPU_FLAGS := -m32 -march=i586
-      else ifeq ($(OPENJDK_TARGET_CPU), ppc64)
-        LIBJSIG_CPU_FLAGS := -mcpu=powerpc64 -mtune=power5
-      else ifeq ($(OPENJDK_TARGET_CPU), ppc64le)
-        LIBJSIG_CPU_FLAGS := -DABI_ELFv2 -mcpu=power8 -mtune=power8
-      else ifeq ($(OPENJDK_TARGET_CPU), s390x)
-        LIBJSIG_CPU_FLAGS := -mbackchain -march=z10
-      endif
-
-    else ifeq ($(OPENJDK_TARGET_OS), solaris)
-      LIBJSIG_CFLAGS := -m64 -KPIC -mt -I $(TOPDIR)/src/hotspot/os/$(HOTSPOT_TARGET_OS_TYPE)/include
-      LIBJSIG_LDFLAGS := -m64 -mt -xnolib
-      LIBJSIG_LIBS := $(LIBDL)
-
-      # NOTE: The old build compiled this library without -soname.
-      # To emulate this, we need to clear out SET_SHARED_LIBRARY_NAME.
-      SET_SHARED_LIBRARY_NAME :=
-
-    else ifeq ($(OPENJDK_TARGET_OS), aix)
-      LIBJSIG_CFLAGS := -q64 -D_GNU_SOURCE -D_REENTRANT -qpic=large
-      LIBJSIG_LDFLAGS := -b64 -bexpall -G -bnoentry -qmkshrobj -brtl -bnolibpath -bernotok
-      LIBJSIG_LIBS := $(LIBDL)
-
-      # NOTE: The old build compiled this library without -soname.
-      # To emulate this, we need to clear out SET_SHARED_LIBRARY_NAME.
-      SET_SHARED_LIBRARY_NAME :=
-
-    else ifeq ($(OPENJDK_TARGET_OS), macosx)
-      LIBJSIG_CFLAGS := -m64 -D_GNU_SOURCE -pthread -mno-omit-leaf-frame-pointer -mstack-alignment=16 -fPIC
-      LIBJSIG_LDFLAGS := $(LIBJSIG_HASHSTYLE_LDFLAGS)
-    else
-      $(error Unknown target OS $(OPENJDK_TARGET_OS) in CompileLibjsig.gmk)
-    endif
-
-    LIBJSIG_SRC_DIR := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjsig
-    LIBJSIG_MAPFILE := $(wildcard $(TOPDIR)/make/mapfiles/libjsig/mapfile-vers-$(OPENJDK_TARGET_OS))
-    LIBJSIG_OUTPUTDIR := $(HOTSPOT_OUTPUTDIR)/libjsig
-
-    LIBJSIG_LDFLAGS += $(SHARED_LIBRARY_FLAGS)
-
-    LIB_OUTPUTDIR := $(call FindLibDirForModule, java.base)
-
-    $(eval $(call SetupNativeCompilation, BUILD_LIBJSIG, \
-        NAME := jsig, \
-        SRC := $(LIBJSIG_SRC_DIR), \
-        OUTPUT_DIR := $(LIB_OUTPUTDIR), \
-        LANG := C, \
-        CFLAGS := $(LIBJSIG_CFLAGS) $(LIBJSIG_CPU_FLAGS), \
-        LDFLAGS := $(LIBJSIG_LDFLAGS) $(LIBJSIG_CPU_FLAGS), \
-        LIBS := $(LIBJSIG_LIBS), \
-        MAPFILE := $(LIBJSIG_MAPFILE), \
-        OBJECT_DIR := $(LIBJSIG_OUTPUTDIR)/objs, \
-    ))
-
-    TARGETS += $(BUILD_LIBJSIG)
-
-    ############################################################################
-    # Create symlinks in each variant sub dir
-    ifeq ($(OPENJDK_TARGET_OS), macosx)
-      DEBUG_INFO_SUFFIX := $(SHARED_LIBRARY_SUFFIX).dSYM
-    else
-      DEBUG_INFO_SUFFIX := .debuginfo
-    endif
-
-    # $1 variant subdir
-    define CreateSymlinks
-      # Always symlink from libdir/variant/libjsig.so -> ../libjsig.so and
-      # the corresponding debuginfo.
-      $(LIB_OUTPUTDIR)/$1/$(call SHARED_LIBRARY,jsig): \
-          $(LIB_OUTPUTDIR)/$(call SHARED_LIBRARY,jsig)
-		$$(call MakeDir, $$(@D))
-		$(RM) $$@
-		$(LN) -s ../$$(@F) $$@
-
-      TARGETS += $(LIB_OUTPUTDIR)/$1/$(call SHARED_LIBRARY,jsig)
-
-      ifeq ($(COPY_DEBUG_SYMBOLS), true)
-        $(LIB_OUTPUTDIR)/$1/$(LIBRARY_PREFIX)jsig$(DEBUG_INFO_SUFFIX): \
-            $(LIB_OUTPUTDIR)/$(call SHARED_LIBRARY,jsig)
-		$$(call MakeDir, $$(@D))
-		$(RM) $$@
-		$(LN) -s ../$$(@F) $$@
-
-        TARGETS += $(LIB_OUTPUTDIR)/$1/$(LIBRARY_PREFIX)jsig$(DEBUG_INFO_SUFFIX)
-
-        ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
-          $(LIB_OUTPUTDIR)/$1/$(LIBRARY_PREFIX)jsig.diz: \
-              $(LIB_OUTPUTDIR)/$1/$(LIBRARY_PREFIX)jsig$(DEBUG_INFO_SUFFIX)
-			$(CD) $$(@D) && $(ZIPEXE) -q -y $$@ $$(basename $$(@F))$(DEBUG_INFO_SUFFIX)
-
-          TARGETS += $(LIB_OUTPUTDIR)/$1/$(LIBRARY_PREFIX)jsig.diz
-        endif
-      endif
-    endef
-
-    # The subdir is the same as the variant for client and minimal, for all
-    # others it's server.
-    VARIANT_SUBDIRS := $(filter client minimal, $(JVM_VARIANTS)) \
-        $(if $(filter-out client minimal, $(JVM_VARIANTS)), server)
-    $(foreach v, $(VARIANT_SUBDIRS), $(eval $(call CreateSymlinks,$v)))
-
-    ############################################################################
-
-    include CopyToExplodedJdk.gmk
-
-  endif
-endif
-
-all: $(TARGETS)
-
-.PHONY: all
--- a/make/lib/Lib-java.base.gmk	Mon Mar 26 20:20:45 2018 +0200
+++ b/make/lib/Lib-java.base.gmk	Mon Mar 26 20:44:32 2018 +0200
@@ -171,6 +171,56 @@
 endif
 
 ################################################################################
+# Create the jsig library
+
+ifneq ($(OPENJDK_TARGET_OS), windows)
+  ifeq ($(STATIC_BUILD), false)
+
+    LIBJSIG_SRC_DIR := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjsig
+    LIBJSIG_MAPFILE := $(wildcard $(TOPDIR)/make/mapfiles/libjsig/mapfile-vers-$(OPENJDK_TARGET_OS))
+
+    $(eval $(call SetupJdkLibrary, BUILD_LIBJSIG, \
+        NAME := jsig, \
+        SRC := $(LIBJSIG_SRC_DIR), \
+        CFLAGS := $(CFLAGS_JDKLIB), \
+        LDFLAGS := $(LDFLAGS_JDKLIB) \
+            $(call SET_SHARED_LIBRARY_ORIGIN), \
+        LIBS_linux := $(LIBDL), \
+        LIBS_solaris := $(LIBDL), \
+        LIBS_aix := $(LIBDL), \
+        MAPFILE := $(LIBJSIG_MAPFILE), \
+    ))
+
+    TARGETS += $(BUILD_LIBJSIG)
+
+    ############################################################################
+    # Create symlinks to libjsig in each JVM variant sub dir
+    LIB_OUTPUTDIR := $(call FindLibDirForModule, java.base)
+
+    # $1 variant subdir
+    define CreateSymlinks
+      # Always symlink from libdir/variant/libjsig.so -> ../libjsig.so.
+      $(LIB_OUTPUTDIR)/$1/$(call SHARED_LIBRARY,jsig): \
+          $(LIB_OUTPUTDIR)/$(call SHARED_LIBRARY,jsig)
+		$$(call MakeDir, $$(@D))
+		$(RM) $$@
+		$(LN) -s ../$$(@F) $$@
+
+      TARGETS += $(LIB_OUTPUTDIR)/$1/$(call SHARED_LIBRARY,jsig)
+    endef
+
+    # The subdir is the same as the variant for client and minimal, for all
+    # others it's server.
+    VARIANT_SUBDIRS := $(filter client minimal, $(JVM_VARIANTS)) \
+        $(if $(filter-out client minimal, $(JVM_VARIANTS)), server)
+    $(foreach v, $(VARIANT_SUBDIRS), $(eval $(call CreateSymlinks,$v)))
+
+    ############################################################################
+
+  endif
+endif
+
+################################################################################
 # Create the symbols file for static builds.
 
 ifeq ($(STATIC_BUILD), true)