Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8071470

Cleanup include and exclude of awt native libraries after source code restructure

XMLWordPrintable

      Separating this from JDK-8055190.

      From Magnus:

      And here is the jury's verdict on Awt2dLibraries.gmk.

      libjavajpeg:
        One of these are not needed:
        LIBJAVAJPEG_SRC := $(JDK_TOPDIR)/src/java.desktop/share/native/libjavajpeg
        LIBJAVAJPEG_SRC += $(JDK_TOPDIR)/src/java.desktop/share/native/libjavajpeg

      libfontmanager:
        EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES) \
              AccelGlyphCache.c, \
        The file AccelGlyphCache.c resides in src/java.desktop/share/native/common/sun/font, which is not included in the source dirs, so the exclude can be safely removed.

      The following stanza can be removed:
      ifeq ($(OPENJDK_TARGET_OS), windows)
        LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
            X11TextRenderer.c
        LIBFONTMANAGER_OPTIMIZATION := HIGHEST
        LIBFONTMANAGER_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/sun/windows
      else ifeq ($(OPENJDK_TARGET_OS), macosx)
        LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
            X11TextRenderer.c \
            fontpath.c \
            lcdglyph.c
      else
        LIBFONTMANAGER_EXCLUDE_FILES += fontpath.c \
            lcdglyph.c
      endif

      The X11*.c files are in the unix directory and the fontpath/lcdglyph files are in the windows directory, so they need to explicit excludes.

      However, the X11 files stills needs to be excluded on macosx. On the other hand, these two are all that exists in $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libfontmanager, so we can just exclude that entire directory, or only add it unless we're building for macosx.

      libkcms:
            EXCLUDE_FILES := $(BUILD_LIBKCMS_EXCLUDE_FILES),
            is not needed, since BUILD_LIBKCMS_EXCLUDE_FILES is no longer defined.

      libjawt:
            INCLUDE_FILES := $(LIBJAWT_INCLUDE_FILES),
            and
            INCLUDE_FILES := $(JAWT_FILES),
            are not needed, since LIBJAWT_INCLUDE_FILES and JAWT_FILES are not defined.

      libawt_lwawt:
            INCLUDE_FILES := $(LIBAWT_LWAWT_FILES),
            is not needed, since LIBAWT_LWAWT_FILES is not defined.

      libt2k:
        According to
            EXCLUDE_FILES := t2k/orion.c,
        the file orion.c is never used, so it should be removed instead. Also, the entire library definition should move to closed code.

      liblcms:
        The include file picking of LCMS.c would not be needed if the upstream lcms source code were moved into a separate subdirectory of liblcms.

      libjavajpeg:
        If the upstream IJG jpeg library were moved into a subdirectory, the explicit includes of imageIOJPEG.c and jpegdecoder.c would not be needed.

      libmlib_image / libmlib_image_v:
        The files used for libmlib_image and libmlib_image_v are somewhat chaotic.

        Four directories are used, in different ways:
        1) SHARE-LIB: java.desktop/share/native/libmlib_image
        2) UNIX-LIB: java.desktop/unix/native/libmlib_image
        3) SHARE-COMMON: java.desktop/share/native/common/sun/awt/medialib
        4) UNIX-COMMON: java.desktop/unix/native/common/sun/awt/medialib

        They are used to build three different libraries:

        A) libmlib_image. Built on all platforms. Includes SHARE-LIB and SHARE-COMMON
        B) libmlib_image_v. Built on solaris-sparc only. Includes a subset (using excludes) of SHARE-LIB, UNIX-LIB, SHARE-COMMON and UNIX-COMMON.
        C) libawt. Uses SHARE-COMMON and UNIX-COMMON, but only when building for solaris-sparc.

        Maybe this complexity is not needed, but even if it is, there are a number of things that could help improve the situation.

        * The UNIX-LIB and UNIX-COMMON paths are only used on solaris and should move from "unix" to "solaris".

        * The SHARE-COMMON and UNIX-COMMON paths should move away from the common/sun/awt directories, since they need to be explicitely excluded by all other users of the common/sun/awt directories, e.g. to common/mlib_image. This would reduce the number of excludes elsewhere significantly.

        * The code in UNIX-LIB is used to build libmlib_image_v, not libmlib_image, and should thus be renamed so.

        * The code in SHARE-LIB that is actually shared by libmlib_image and libmlib_image_v should preferably be moved to java.desktop/share/native/common. I don't have any good suggestions though on how this should be handled so as not to collide with the different shared subset found in SHARE-COMMON. These files include basically the mlib_Image*.c files. It also includes the file mlib_c_ImageThresh1_U8.c, while excluding all other mlib_c_*.c. This almost looks like a mistake.

        * A number of files are hardcoded to always be excluded. These should be removed instead. These files are:

          In java.desktop/share/native/libmlib_image:
            mlib_c_ImageBlendTable.c

          In java.desktop/unix/native/libmlib_image:
            mlib_v_ImageChannelExtract.c \
            mlib_v_ImageChannelExtract_f.c \
            mlib_v_ImageChannelInsert_34.c \
            mlib_v_ImageChannelInsert.c \
            mlib_v_ImageConvIndex3_8_16nw.c \
            mlib_v_ImageConvIndex3_8_8nw.c \
            mlib_v_ImageCopy.c \
            mlib_v_ImageCopy_blk.s \


      libawt et al:
        The relation between libawt, libawt_headless, libjawt, libawt_xawt and libawt_lwawt are hairy enough to make my brain curl up. I believe there are simplifications to be made but I gave up trying to figure them out.

      /Magnus

            Unassigned Unassigned
            erikj Erik Joelsson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: