build with bsd userland

Radim Kolar hsn at sanatana.filez.com
Thu Mar 20 00:53:28 UTC 2014


on bsd systems, gnu versions of utils are installed with g prefix, such 
as gsed instead of sed.

this patch adds checking for such versions and uses them if found in 
path. With this patch it bootrap icedtea build system correctly on fbsd 10.

it still does not build openjdk out of box with patch, fails on:

gmake[1]: Entering directory `/home/hsn/live/icedtea7/openjdk-boot'
jdk/make/common/shared/Defs.gmk:194: "WARNING: Value of ARCH cannot be 
empty, will use ''"
jdk/make/common/shared/Defs.gmk:194: "WARNING: Value of PLATFORM cannot 
be empty, will use ''"
jdk/make/common/shared/Defs.gmk:397: jdk/make/common/shared/Defs-.gmk: 
No such file or directory
jdk/make/common/shared/Defs.gmk:674: 
jdk/make/common/shared/Compiler-.gmk: No such file or directory
gmake[1]: *** No rule to make target 
`jdk/make/common/shared/Compiler-.gmk'.  Stop.

I did not discovered where these variables are supposed to be set, after 
setting this manually to linux, it crosscompiles major portion of JDK.
-------------- next part --------------
diff -r b1043cc0cd82 Makefile.am
--- a/Makefile.am	Sat Mar 08 18:06:34 2014 +0000
+++ b/Makefile.am	Thu Mar 20 01:46:41 2014 +0100
@@ -1141,7 +1141,7 @@
 	      *.zip) $(UNZIP) -q $(OPENJDK_SRC_ZIP) ;; \
 	      *.tar.*) $(TAR) xf $(OPENJDK_SRC_ZIP) ;; \
 	    esac; \
-	    mv `echo $(ICEDTEA_PREFIX)|sed 's#\.#-#'`-$(OPENJDK_CHANGESET) openjdk ; \
+	    mv `echo $(ICEDTEA_PREFIX)|$(SED) 's#\.#-#'`-$(OPENJDK_CHANGESET) openjdk ; \
 	  else \
 	    echo "ERROR: Couldn't extract OpenJDK"; \
 	    false; \
@@ -1486,7 +1486,7 @@
 	if test x"$(VERSION_SUFFIX)" != "x"; then \
 	  ver_suffix="-$(VERSION_SUFFIX)"; \
 	fi ; \
-	sed -i "s#BUILD_VARIANT_RELEASE)#BUILD_VARIANT_RELEASE)$${proj_suffix}$${ver_suffix}#" \
+	$(SED) -i "s#BUILD_VARIANT_RELEASE)#BUILD_VARIANT_RELEASE)$${proj_suffix}$${ver_suffix}#" \
 	  openjdk/jdk/make/common/shared/Defs.gmk;
 	mkdir -p stamps
 	touch $@
@@ -1718,13 +1718,13 @@
 	mkdir -p $(BUILD_OUTPUT_DIR)/j2sdk-image/tapset ; \
 	grep "client IGNORE" $(BUILD_JRE_ARCH_DIR)/jvm.cfg; \
 	if test $$? -eq 0; then \
-	  sed -e '/\/client\/libjvm.so/d' \
+	  $(SED) -e '/\/client\/libjvm.so/d' \
 	    < $(abs_top_builddir)/tapset/hotspot.stp \
 	    > $(BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot.stp; \
-	  sed -e '/\/client\/libjvm.so/d' \
+	  $(SED) -e '/\/client\/libjvm.so/d' \
 	    < $(abs_top_builddir)/tapset/hotspot_jni.stp \
 	    > $(BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot_jni.stp; \
-	  sed -e '/\/client\/libjvm.so/d' \
+	  $(SED) -e '/\/client\/libjvm.so/d' \
 	    < $(abs_top_builddir)/tapset/hotspot_gc.stp \
 	    > $(BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot_gc.stp; \
 	else \
@@ -1854,13 +1854,13 @@
 	mkdir -p $(DEBUG_BUILD_OUTPUT_DIR)/j2sdk-image/tapset ; \
 	grep "client IGNORE" $(BUILD_JRE_ARCH_DIR)/jvm.cfg; \
 	if test $$? -eq 0; then \
-	  sed -e '/\/client\/libjvm.so/d' \
+	  $(SED) -e '/\/client\/libjvm.so/d' \
 	    < $(abs_top_builddir)/tapset/hotspot.stp \
 	    > $(DEBUG_BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot.stp; \
-	  sed -e '/\/client\/libjvm.so/d' \
+	  $(SED) -e '/\/client\/libjvm.so/d' \
 	    < $(abs_top_builddir)/tapset/hotspot_jni.stp \
 	    > $(DEBUG_BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot_jni.stp; \
-	  sed -e '/\/client\/libjvm.so/d' \
+	  $(SED) -e '/\/client\/libjvm.so/d' \
 	    < $(abs_top_builddir)/tapset/hotspot_gc.stp \
 	    > $(DEBUG_BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot_gc.stp; \
 	else \
@@ -1991,13 +1991,13 @@
 	mkdir -p $(BOOT_BUILD_OUTPUT_DIR)/j2sdk-image/tapset ; \
 	grep "client IGNORE" $(BUILD_JRE_ARCH_DIR)/jvm.cfg; \
 	if test $$? -eq 0; then \
-	  sed -e '/\/client\/libjvm.so/d' \
+	  $(SED) -e '/\/client\/libjvm.so/d' \
 	    < $(abs_top_builddir)/tapset/hotspot.stp \
 	    > $(BOOT_BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot.stp; \
-	  sed -e '/\/client\/libjvm.so/d' \
+	  $(SED) -e '/\/client\/libjvm.so/d' \
 	    < $(abs_top_builddir)/tapset/hotspot_jni.stp \
 	    > $(BOOT_BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot_jni.stp; \
-	  sed -e '/\/client\/libjvm.so/d' \
+	  $(SED) -e '/\/client\/libjvm.so/d' \
 	    < $(abs_top_builddir)/tapset/hotspot_gc.stp \
 	    > $(BOOT_BUILD_OUTPUT_DIR)/j2sdk-image/tapset/hotspot_gc.stp; \
 	else \
@@ -2215,10 +2215,10 @@
 	  org.mozilla sun.org.mozilla && \
 	(cd rhino/rhino.old && \
 	 for files in `find -type f -not -name '*.class'` ; do \
-	   new_file=../rhino.new/`echo $$files|sed -e 's#org#sun/org#'` ; \
+	   new_file=../rhino.new/`echo $$files|$(SED) -e 's#org#sun/org#'` ; \
 	   mkdir -p `dirname $$new_file` ; \
 	   cp -v $$files $$new_file ; \
-	   sed -ie 's#org\.mozilla#sun.org.mozilla#g' $$new_file ; \
+	   $(SED) -ie 's#org\.mozilla#sun.org.mozilla#g' $$new_file ; \
 	 done \
 	) && \
 	(cd rhino/rhino.new && \
@@ -2274,7 +2274,7 @@
 clean-add-jamvm:
 	rm -rf $(BUILD_JRE_ARCH_DIR)/jamvm
 	if [ -e $(BUILD_JRE_ARCH_DIR)/jvm.cfg ] ; then \
-	  sed -i 's#-jamvm KNOWN#-jamvm ERROR#' $(BUILD_JRE_ARCH_DIR)/jvm.cfg ; \
+	  $(SED) -i 's#-jamvm KNOWN#-jamvm ERROR#' $(BUILD_JRE_ARCH_DIR)/jvm.cfg ; \
 	fi
 	rm -f stamps/add-jamvm.stamp
 
@@ -2292,7 +2292,7 @@
 clean-add-jamvm-debug:
 	rm -rf $(BUILD_DEBUG_JRE_ARCH_DIR)/jamvm
 	if [ -e $(BUILD_DEBUG_JRE_ARCH_DIR)/jvm.cfg ] ; then \
-	  sed -i 's#-jamvm KNOWN#-jamvm ERROR#' $(BUILD_DEBUG_JRE_ARCH_DIR)/jvm.cfg ; \
+	  $(SED) -i 's#-jamvm KNOWN#-jamvm ERROR#' $(BUILD_DEBUG_JRE_ARCH_DIR)/jvm.cfg ; \
 	fi
 	rm -f stamps/add-jamvm-debug.stamp
 
@@ -2345,7 +2345,7 @@
 clean-add-cacao:
 	rm -rf $(BUILD_JRE_ARCH_DIR)/cacao
 	if [ -e $(BUILD_JRE_ARCH_DIR)/jvm.cfg ] ; then \
-	  sed -i 's#-cacao KNOWN#-cacao ERROR#' $(BUILD_JRE_ARCH_DIR)/jvm.cfg ; \
+	  $(SED) -i 's#-cacao KNOWN#-cacao ERROR#' $(BUILD_JRE_ARCH_DIR)/jvm.cfg ; \
 	fi
 	rm -f stamps/add-cacao.stamp
 
@@ -2367,7 +2367,7 @@
 clean-add-cacao-debug:
 	rm -rf $(BUILD_DEBUG_JRE_ARCH_DIR)/cacao
 	if [ -e $(BUILD_DEBUG_JRE_ARCH_DIR)/jvm.cfg ] ; then \
-	  sed -i 's#-cacao KNOWN#-cacao ERROR#' $(BUILD_DEBUG_JRE_ARCH_DIR)/jvm.cfg ; \
+	  $(SED) -i 's#-cacao KNOWN#-cacao ERROR#' $(BUILD_DEBUG_JRE_ARCH_DIR)/jvm.cfg ; \
 	fi
 	rm -f stamps/add-cacao-debug.stamp
 
@@ -2435,8 +2435,8 @@
 	rm -rf $(BUILD_JRE_ARCH_DIR)/shark
 	rm -rf zerovm
 	if [ -e $(BUILD_JRE_ARCH_DIR)/jvm.cfg ] ; then \
-	  sed -i 's#-zero KNOWN#-zero ERROR#' $(BUILD_JRE_ARCH_DIR)/jvm.cfg ; \
-	  sed -i 's#-shark KNOWN#-shark ERROR#' $(BUILD_JRE_ARCH_DIR)/jvm.cfg ; \
+	  $(SED) -i 's#-zero KNOWN#-zero ERROR#' $(BUILD_JRE_ARCH_DIR)/jvm.cfg ; \
+	  $(SED) -i 's#-shark KNOWN#-shark ERROR#' $(BUILD_JRE_ARCH_DIR)/jvm.cfg ; \
 	fi
 	rm -f stamps/add-zero.stamp
 
@@ -2474,8 +2474,8 @@
 	rm -rf $(BUILD_DEBUG_JRE_ARCH_DIR)/shark
 	rm -rf zerovm
 	if [ -e $(BUILD_DEBUG_JRE_ARCH_DIR)/jvm.cfg ] ; then \
-	  sed -i 's#-zero KNOWN#-zero ERROR#' $(BUILD_DEBUG_JRE_ARCH_DIR)/jvm.cfg ; \
-	  sed -i 's#-shark KNOWN#-shark ERROR#' $(BUILD_DEBUG_JRE_ARCH_DIR)/jvm.cfg ; \
+	  $(SED) -i 's#-zero KNOWN#-zero ERROR#' $(BUILD_DEBUG_JRE_ARCH_DIR)/jvm.cfg ; \
+	  $(SED) -i 's#-shark KNOWN#-shark ERROR#' $(BUILD_DEBUG_JRE_ARCH_DIR)/jvm.cfg ; \
 	fi
 	rm -f stamps/add-zero-debug.stamp
 
@@ -2553,7 +2553,7 @@
 # FIXME: this might need some adjustment for other OS than Linux
 jtreg_processes = ps x -ww -o pid,ppid,args \
 	| awk '$$2 == 1 && $$3 ~ /^$(subst /,\/,/scratch)/' \
-	| sed 's,$(CURDIR)/$(sdkimg),<sdkimg>,g;s,$(CURDIR),<pwd>,g'
+	| $(SED) 's,$(CURDIR)/$(sdkimg),<sdkimg>,g;s,$(CURDIR),<pwd>,g'
 jtreg_pids = ps x --no-headers -ww -o pid,ppid,args \
 	| awk '$$2 == 1 && $$3 ~ /^$(subst /,\/,$(CURDIR)/$(sdkimg))/ {print $$1}'
 
@@ -2634,7 +2634,7 @@
 	   cd lib/rt ; \
 	   for dirs in $(ICEDTEA_BOOTSTRAP_RESOURCES) ; \
 	     do \
-	     destpath=`echo $$dirs|sed -e 's#$(LANGTOOLS)/##' -e 's#$(SHARE)/##'` ; \
+	     destpath=`echo $$dirs|$(SED) -e 's#$(LANGTOOLS)/##' -e 's#$(SHARE)/##'` ; \
 	     mkdir -p `dirname $$destpath` ; \
 	     cp -a ../../$$dirs $$destpath ; \
 	   done ; \
diff -r b1043cc0cd82 acinclude.m4
--- a/acinclude.m4	Sat Mar 08 18:06:34 2014 +0000
+++ b/acinclude.m4	Thu Mar 20 01:46:41 2014 +0100
@@ -657,6 +657,14 @@
  AC_SUBST([$1])
 ])
 
+AC_DEFUN([IT_FIND_TOOLS],
+[AC_PATH_PROGS([$1],[$2])
+ if test x"$$1" = x ; then
+   AC_MSG_ERROR([none program of $2 was found])
+ fi
+ AC_SUBST([$1])
+])
+
 AC_DEFUN_ONCE([IT_ENABLE_ZERO_BUILD],
 [
   AC_REQUIRE([IT_SET_ARCH_SETTINGS])
diff -r b1043cc0cd82 configure.ac
--- a/configure.ac	Sat Mar 08 18:06:34 2014 +0000
+++ b/configure.ac	Thu Mar 20 01:46:41 2014 +0100
@@ -18,24 +18,21 @@
 AC_PROG_CC
 AC_PROG_CXX
 
-IT_FIND_TOOL([MAKE], [make])
+IT_FIND_TOOLS([MAKE], [gmake make])
 IT_FIND_TOOL([GZIP], [gzip])
 IT_FIND_TOOL([ANT], [ant])
-IT_FIND_TOOL([FIND], [find])
-IT_FIND_TOOL([PATCH], [patch])
-IT_FIND_TOOL([TAR], [tar])
+IT_FIND_TOOLS([FIND], [gfind find])
+IT_FIND_TOOLS([PATCH], [gpatch patch])
+IT_FIND_TOOLS([TAR], [gtar tar])
 IT_FIND_TOOL([CHMOD], [chmod])
-IT_FIND_TOOL([SHA256SUM], [sha256sum])
+IT_FIND_TOOLS([SHA256SUM], [gsha256sum sha256sum])
 IT_FIND_TOOL([WGET], [wget])
 IT_FIND_TOOL([ZIP], [zip])
 IT_FIND_TOOL([UNZIP], [unzip])
 IT_FIND_TOOL([CPIO], [cpio])
 IT_FIND_TOOL([FILE], [file])
-AC_CHECK_TOOLS([FASTJAR], [fastjar jar])
-if test "x$FASTJAR" = x; then
-	AC_MSG_ERROR([Can't find fastjar or jar])
-fi
-AC_SUBST([FASTJAR])
+IT_FIND_TOOLS([FASTJAR], [fastjar jar])
+IT_FIND_TOOLS([SED],[gsed sed])
 AC_CHECK_TOOL([LDD], [ldd])
 dnl OpenJDK's README-builds.html lists gawk as a build dependency so we
 dnl check for it explicitly rather than using AC_PROG_AWK.


More information about the distro-pkg-dev mailing list