jdk: Avoid PKG_PATH build var

Greg Lewis glewis at eyesbeyond.com
Fri Jan 9 20:26:56 PST 2009


G'day Kurt,

On Fri, Jan 09, 2009 at 02:47:39PM -0500, Kurt Miller wrote:
> PKG_PATH is a commonly set env var on Free/Open/NetBSD for
> pkg_add(1). Switch to LOCALBASE which avoids the conflict and
> matches Free/Open/NetBSD ports building var for /usr/local.
> Also move the definition up so that Defs-bsd.gmk can use
> LOCALBASE correctly.

I really wanted to avoid LOCALBASE when I implemented that because
all the other "path" environment variables that the build uses end in
_PATH (well, except for ALT_BOOTDIR I guess).  It also seemed biased
towards {Free,Net,Open}BSD over Mac OS X.  Thats also why it ended
up being X11_PATH rather than X11BASE.

PKG_PATH seemed a good fit -- I didn't realise that pkg_add used it
(probably because I pretty much always build from ports rather than
installing packages :).  It also worked for Linux and Solaris (most
of the changes aren't BSD specific files) since they both have a
concept of installing third party software packages somewhere.

LOCALBASE (and LOCAL_PATH for that matter) aren't really going to
be intuitive to most Linux and Solaris users, IMO.

How about PACKAGE_PATH?  Thats unfortunately much longer, and I'm
sure it still collides with some utility somewhere, but at least it
doesn't collide with an obvious one for us :).

> diff -r 1536df243bf6 make/common/Defs.gmk
> --- a/make/common/Defs.gmk	Fri Jan 09 09:01:03 2009 -0500
> +++ b/make/common/Defs.gmk	Fri Jan 09 14:35:28 2009 -0500
> @@ -172,6 +172,24 @@
>    endif
>  endif # OPENJDK
>  
> +ifneq ($(PLATFORM), windows)
> +  ifdef ALT_X11_PATH
> +    X11_PATH = $(ALT_X11_PATH)
> +  else
> +    X11_PATH = /usr/X11R6
> +  endif 
> +
> +  ifdef ALT_LOCALBASE
> +    LOCALBASE = $(ALT_LOCALBASE)
> +  else
> +    ifeq ($(PLATFORM), linux)
> +      LOCALBASE = /usr
> +    else
> +      LOCALBASE = /usr/local
> +    endif
> +  endif
> +endif
> +
>  #
>  # Get platform definitions
>  #
> @@ -230,24 +248,6 @@
>        FREETYPE_HEADERS_PATH = $(DEVTOOLS_FT_DIR)/include
>      else
>        FREETYPE_HEADERS_PATH = /usr/include
> -    endif
> -  endif
> -endif
> -
> -ifneq ($(PLATFORM), windows)
> -  ifdef ALT_X11_PATH
> -    X11_PATH = $(ALT_X11_PATH)
> -  else
> -    X11_PATH = /usr/X11R6
> -  endif 
> -
> -  ifdef ALT_PKG_PATH
> -    PKG_PATH = $(ALT_PKG_PATH)
> -  else
> -    ifeq ($(PLATFORM), linux)
> -      PKG_PATH = /usr
> -    else
> -      PKG_PATH = /usr/local
>      endif
>    endif
>  endif
> diff -r 1536df243bf6 make/common/shared/Defs-bsd.gmk
> --- a/make/common/shared/Defs-bsd.gmk	Fri Jan 09 09:01:03 2009 -0500
> +++ b/make/common/shared/Defs-bsd.gmk	Fri Jan 09 14:35:28 2009 -0500
> @@ -54,7 +54,7 @@
>  endef
>  
>  # Location on system where jdk installs might be
> -USRJDKINSTANCES_PATH = $(PKG_PATH)
> +USRJDKINSTANCES_PATH = $(LOCALBASE)
>  
>  # UNIXCOMMAND_PATH: path to where the most common Unix commands are.
>  #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
> @@ -121,7 +121,7 @@
>  BUILD_HEADLESS = true
>  LIBM=-lm
>  
> -_CUPS_HEADERS_PATH=$(PKG_PATH)/include
> +_CUPS_HEADERS_PATH=$(LOCALBASE)/include
>  
>  # Import JDK images allow for partial builds, components not built are
>  #    imported (or copied from) these import areas when needed.
> diff -r 1536df243bf6 make/java/instrument/Makefile
> --- a/make/java/instrument/Makefile	Fri Jan 09 09:01:03 2009 -0500
> +++ b/make/java/instrument/Makefile	Fri Jan 09 14:35:28 2009 -0500
> @@ -112,7 +112,7 @@
>      LDFLAGS += -Wl,--no-whole-archive
>    endif
>  
> -  ICONV_PATH = $(PKG_PATH)
> +  ICONV_PATH = $(LOCALBASE)
>  # Use CPPFLAGS instead of OTHER_INCLUDES to force this last
>    CPPFLAGS += -I$(ICONV_PATH)/include
>    OTHER_LDLIBS += -L$(ICONV_PATH)/lib -liconv
> diff -r 1536df243bf6 make/java/jli/Makefile
> --- a/make/java/jli/Makefile	Fri Jan 09 09:01:03 2009 -0500
> +++ b/make/java/jli/Makefile	Fri Jan 09 14:35:28 2009 -0500
> @@ -97,7 +97,7 @@
>    LIBARCH_DEFINES += -DLIBARCH64NAME='"$(LIBARCH64)"'
>  endif
>  
> -OTHER_CPPFLAGS += $(LIBARCH_DEFINES) -DPKG_PATH=\"$(PKG_PATH)\"
> +OTHER_CPPFLAGS += $(LIBARCH_DEFINES) -DLOCALBASE=\"$(LOCALBASE)\"
>  
>  
>  ifneq ($(PLATFORM), windows)	# UNIX systems
> diff -r 1536df243bf6 make/java/npt/Makefile
> --- a/make/java/npt/Makefile	Fri Jan 09 09:01:03 2009 -0500
> +++ b/make/java/npt/Makefile	Fri Jan 09 14:35:28 2009 -0500
> @@ -67,7 +67,7 @@
>  
>  # Add location of iconv headers
>  ifeq ($(PLATFORM), bsd)
> -  ICONV_PATH = $(PKG_PATH)
> +  ICONV_PATH = $(LOCALBASE)
>    CPPFLAGS += -I$(ICONV_PATH)/include
>    OTHER_LDLIBS += -L$(ICONV_PATH)/lib -liconv
>  endif
> diff -r 1536df243bf6 make/sun/awt/mawt.gmk
> --- a/make/sun/awt/mawt.gmk	Fri Jan 09 09:01:03 2009 -0500
> +++ b/make/sun/awt/mawt.gmk	Fri Jan 09 14:35:28 2009 -0500
> @@ -250,7 +250,7 @@
>  endif
>  
>  ifneq ($(PLATFORM), windows)
> -  CPPFLAGS += -DX11_PATH=\"$(X11_PATH)\" -DPKG_PATH=\"$(PKG_PATH)\"
> +  CPPFLAGS += -DX11_PATH=\"$(X11_PATH)\" -DLOCALBASE=\"$(LOCALBASE)\"
>  endif
>  
>  LDFLAGS += -L$(LIBDIR)/$(LIBARCH)/$(TSOBJDIR) \
> diff -r 1536df243bf6 make/sun/splashscreen/Makefile
> --- a/make/sun/splashscreen/Makefile	Fri Jan 09 09:01:03 2009 -0500
> +++ b/make/sun/splashscreen/Makefile	Fri Jan 09 14:35:28 2009 -0500
> @@ -72,7 +72,7 @@
>    CFLAGS += -DWITH_X11
>    ifeq ($(PLATFORM), bsd)
>      CFLAGS += -DPNG_NO_MMX_CODE
> -    ICONV_PATH = $(PKG_PATH)
> +    ICONV_PATH = $(LOCALBASE)
>      CPPFLAGS += -I$(OPENWIN_HOME)/include \
>                  -I$(OPENWIN_HOME)/include/X11/extensions \
>                  -I$(ICONV_PATH)/include
> diff -r 1536df243bf6 make/sun/xawt/Makefile
> --- a/make/sun/xawt/Makefile	Fri Jan 09 09:01:03 2009 -0500
> +++ b/make/sun/xawt/Makefile	Fri Jan 09 14:35:28 2009 -0500
> @@ -148,7 +148,7 @@
>  endif
>  
>  ifneq ($(PLATFORM), windows)
> -  CPPFLAGS += -DX11_PATH=\"$(X11_PATH)\" -DPKG_PATH=\"$(PKG_PATH)\"
> +  CPPFLAGS += -DX11_PATH=\"$(X11_PATH)\" -DLOCALBASE=\"$(LOCALBASE)\"
>  endif
>  
>  ifeq ($(MILESTONE), internal)
> diff -r 1536df243bf6 src/solaris/bin/java_md.c
> --- a/src/solaris/bin/java_md.c	Fri Jan 09 09:01:03 2009 -0500
> +++ b/src/solaris/bin/java_md.c	Fri Jan 09 14:35:28 2009 -0500
> @@ -97,19 +97,19 @@
>   *      entries, but actual strings can be more efficient (with many compilers).
>   */
>  #if defined(__FreeBSD__)
> -static const char *system_dir	= PKG_PATH "/openjdk7";
> +static const char *system_dir	= LOCALBASE "/openjdk7";
>  static const char *user_dir	= "/java";
>  #elif defined(__NetBSD__)
> -static const char *system_dir	= PKG_PATH "/openjdk7";
> +static const char *system_dir	= LOCALBASE "/openjdk7";
>  static const char *user_dir	= "/java";
>  #elif defined(__OpenBSD__)
> -static const char *system_dir	= PKG_PATH "/openjdk7";
> +static const char *system_dir	= LOCALBASE "/openjdk7";
>  static const char *user_dir	= "/java";
>  #elif defined(__APPLE__)
> -static const char *system_dir	= PKG_PATH "/openjdk7";
> +static const char *system_dir	= LOCALBASE "/openjdk7";
>  static const char *user_dir	= "/java";
>  #elif defined(__linux__)
> -static const char *system_dir   = PKG_PATH "/java";
> +static const char *system_dir   = LOCALBASE "/java";
>  static const char *user_dir     = "/java";
>  #else /* Solaris */
>  static const char *system_dir   = "/usr/jdk";
> diff -r 1536df243bf6 src/solaris/native/sun/awt/fontpath.c
> --- a/src/solaris/native/sun/awt/fontpath.c	Fri Jan 09 09:01:03 2009 -0500
> +++ b/src/solaris/native/sun/awt/fontpath.c	Fri Jan 09 14:35:28 2009 -0500
> @@ -134,13 +134,13 @@
>      X11_PATH "/lib/X11/fonts/tt",
>      X11_PATH "/lib/X11/fonts/TTF",
>      X11_PATH "/lib/X11/fonts/OTF",
> -    PKG_PATH "/share/fonts/TrueType",
> -    PKG_PATH "/share/fonts/truetype",
> -    PKG_PATH "/share/fonts/tt",
> -    PKG_PATH "/share/fonts/TTF",
> -    PKG_PATH "/share/fonts/OTF",
> +    LOCALBASE "/share/fonts/TrueType",
> +    LOCALBASE "/share/fonts/truetype",
> +    LOCALBASE "/share/fonts/tt",
> +    LOCALBASE "/share/fonts/TTF",
> +    LOCALBASE "/share/fonts/OTF",
>      X11_PATH "/lib/X11/fonts/Type1",
> -    PKG_PATH "/share/fonts/Type1",
> +    LOCALBASE "/share/fonts/Type1",
>      NULL, /* terminates the list */
>  };
>  #else /* __linux */
> @@ -153,14 +153,14 @@
>      X11_PATH "/lib/X11/fonts/tt",
>      X11_PATH "/lib/X11/fonts/TTF",
>      X11_PATH "/lib/X11/fonts/OTF",       /* RH 9.0 (but empty!) */
> -    PKG_PATH "/share/fonts/ja/TrueType",       /* RH 7.2+ */
> -    PKG_PATH "/share/fonts/truetype",
> -    PKG_PATH "/share/fonts/ko/TrueType",       /* RH 9.0 */
> -    PKG_PATH "/share/fonts/zh_CN/TrueType",    /* RH 9.0 */
> -    PKG_PATH "/share/fonts/zh_TW/TrueType",    /* RH 9.0 */
> +    LOCALBASE "/share/fonts/ja/TrueType",       /* RH 7.2+ */
> +    LOCALBASE "/share/fonts/truetype",
> +    LOCALBASE "/share/fonts/ko/TrueType",       /* RH 9.0 */
> +    LOCALBASE "/share/fonts/zh_CN/TrueType",    /* RH 9.0 */
> +    LOCALBASE "/share/fonts/zh_TW/TrueType",    /* RH 9.0 */
>      "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType", /* Debian */
>      X11_PATH "/lib/X11/fonts/Type1",
> -    PKG_PATH "/share/fonts/default/Type1",     /* RH 9.0 */
> +    LOCALBASE "/share/fonts/default/Type1",     /* RH 9.0 */
>      NULL, /* terminates the list */
>  };
>  #endif

-- 
Greg Lewis                          Email   : glewis at eyesbeyond.com
Eyes Beyond                         Web     : http://www.eyesbeyond.com
Information Technology              FreeBSD : glewis at FreeBSD.org



More information about the bsd-port-dev mailing list