# $Id: Portfile 115275 2013-12-30 15:20:02Z landonf@macports.org $ PortSystem 1.0 PortGroup select 1.0 name openjdk7 # Actual port patchset version set jport_minor_version 45 set jport_build_number 18 set jdk_major_version 7 # Source drop version set jdk_minor_version 40 set jdk_build_number 43 set jdk_build_date 26_aug_2013 version ${jdk_major_version}.${jport_minor_version}.${jport_build_number} revision 5 categories java maintainers landonf openmaintainer platforms darwin homepage http://openjdk.java.net/ description An open-source implementation of the Java Platform, Standard Edition. long_description \ OpenJDK is an open-source implementation of the Java Platform, Standard Edition. \ \ Much of the OpenJDK code is licensed under the GPL version 2 with the \ Classpath exception. The Java Hotspot virtual machine source code is \ licensed under the GPL version 2 only. # Licensed GPLv2-CPE. See also: # - http://openjdk.java.net/legal/gplv2+ce.html # - http://en.wikipedia.org/wiki/GPL_linking_exception#The_classpath_exception license Permissive select.group java select.file ${filespath}/${name} notes \ "To make $name the default, please run \tsudo port select --set ${select.group} $name" # Use our own version of ant to avoid circular dependencies set ant_version 1.8.4 set ant_distfile apache-ant-${ant_version}-bin set rhino_distfile rhino_jdk7.tar.gz use_zip yes distname openjdk-${jdk_major_version}u${jdk_minor_version}-fcs-src-b${jdk_build_number}-${jdk_build_date} distfiles ${distname}${extract.suffix} \ ${ant_distfile}${extract.suffix}:ant \ ${rhino_distfile}:rhino master_sites http://download.java.net/openjdk/jdk${jdk_major_version}u${jdk_minor_version}/promoted/b${jdk_build_number}/ \ http://download.oracle.com/otn-pub/oss/jdk/:rhino \ apache:ant/binaries:ant checksums ${distname}${extract.suffix} sha256 00f8ea561876cbcad174ba3ca7a9ae10b50df46a782ac64c2ac57ac357b50596 \ ${rhino_distfile} sha256 cfd2459bd77e90c7b4fe3092af8b82f34f649f9c91bf59fabaf24a46d9bbb9c2 \ ${ant_distfile}${extract.suffix} sha256 d49d60bc0468279125e4a0db4d9b6637cab342a4bd736c90c0b71865b26c1479 patchfiles patch-jdk7u45-b18 \ patch-extension-directories \ patch-rhino use_configure no use_parallel_build no depends_run port:java_select depends_lib port:libiconv \ port:freetype \ port:xorg-libX11 \ port:xorg-libXtst \ port:dejavu-fonts # OpenJDK7 requires gcc/llvm-gcc; we whitelist llvm-gcc-42 to help ensure a consistent build environment. # Java 8 should support clang directly compiler.whitelist llvm-gcc-4.2 # NOTES: # Apple's jobjc depends on both Ruby and Haskell. # The test suite requires jtreg. depends_build port:ghc \ port:ruby \ port:jtreg set cryptoflag "UNLIMITED_CRYPTO=true" variant limited_strength_jce description {Use the limited stength JCE policy files. By default, the unlimited strength policy files will be included.} { build.args-delete ${cryptoflag} } # Find a usable bootstrap VM if {[file exists ${prefix}/share/java/openjdk7/bin/java]} { # A previous OpenJDK7 release is already installed set bootflags {} set bootstrapvm "${prefix}/share/java/openjdk7" } else { # A bootstrap binary is required to build depends_build-append port:openjdk_bootstrap set bootflags {} set bootstrapvm "${prefix}/share/java/openjdk_bootstrap" } if {false} { # Unreachable. We can bootstrap using a system-installed # Java 1.6 binary, but using our own bootstrap is preferred (and automatic). set bootflags "SA_APPLE_BOOT_JAVA=true ALWAYS_PASS_TEST_GAMMA=true" set bootstrapvm [exec /usr/libexec/java_home -v 1.6] } # Extract the Rhino sources. This has to e done manually, as MacPorts # does not support extracting multiple types of distfiles automatically. extract.only-delete ${rhino_distfile} post-extract { set expand "gzip -cd ${distpath}/${rhino_distfile}" set untar "${portutil::autoconf::tar_command} -xf -" system -W ${workpath} "${expand} | ${untar}" } worksrcdir "openjdk" set rhino_srcpath "${workpath}/rhino_jdk7" post-patch { # Inject the Rhino sources file copy "${rhino_srcpath}/src/sun/org" "${worksrcpath}/jdk/src/share/classes/sun" # Allow loading of extensions and libraries from $prefix reinplace "s|@@PREFIX@@|${prefix}|g" "${worksrcpath}/hotspot/src/os/bsd/vm/os_bsd.cpp" # The jobjc build system includes hard-coded references to /usr/bin/ant; Java build tools (such as ant) # are no longer shipped with Xcode 5.0+ on Mavericks. reinplace "s|/usr/bin/ant|${workpath}/apache-ant-${ant_version}/bin/ant|g" \ "${worksrcpath}/jdk/make/java/jobjc/Makefile" \ "${worksrcpath}/jdk/src/macosx/native/jobjc/JObjC.xcodeproj/project.pbxproj" # Fix missing executable permissions on the code generator file attributes "${worksrcpath}/jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs" -permissions 0755 } # Override the overzealous setting of build environmental variables and settings. These # assume the use of (a well-behaved) autoconf, and cause an assortment of odd build failures when # used with OpenJDK's build system. # # Unfortunately there's no simple knob to turn the argument insertion off, so this will # probably have to be updated in the future build.env {} build.pre_args {} build.post_args {} # Determine the OpenJDK architecture name supported_archs i386 x86_64 if {${build_arch} == "i386"} { set openjdk_build_arch "i586" } elseif {${build_arch} == "x86_64"} { set openjdk_build_arch "${build_arch}" } else { # Unknown architecture return -code error "Platform unsupported" } # LLVM GCC is required by the build, but no longer shipped in Xcode. # In addition, Mavericks has marked a number of APIs required by JDK 7 # as deprecated, mandating the use of -Wno-deprecated-declarations build.args \ CC="${configure.cc}" \ CXX="${configure.cxx}" \ EXTRA_CFLAGS="-Wno-deprecated-declarations -I\"${filespath}/clang-compat-headers\"" \ LANG="C" \ "${bootflags}" \ "${cryptoflag}" \ ALT_BOOTDIR="${bootstrapvm}" \ ALT_COMPILER_PATH="${prefix}" \ ANT_HOME="${workpath}/apache-ant-${ant_version}" \ ALT_FREETYPE_HEADERS_PATH="${prefix}/include" \ ALT_FREETYPE_LIB_PATH="${prefix}/lib" \ ALT_X11_PATH="${prefix}" \ ALT_DEVTOOLS_PATH=/usr \ ALT_CACERTS_FILE=/System/Library/Frameworks/JavaVM.framework/Home/lib/security/cacerts \ NO_DOCS="true" \ SKIP_COMPARE_IMAGES="true" \ SKIP_FASTDEBUG_BUILD="true" \ SKIP_DEBUG_BUILD="true" \ ZIP_DEBUGINFO_FILES=0 \ ENABLE_FULL_DEBUG_SYMBOLS=0 \ MILESTONE="fcs" \ JDK_MICRO_VERSION="0_${jport_minor_version}" \ BUILD_NUMBER="b${jport_build_number}" \ MILESTONE=fcs \ BUNDLE_NAME="OpenJDK ${jdk_major_version} (MacPorts)" \ BUNDLE_INFO="OpenJDK MacPorts ${name}-${version}" \ BUNDLE_ID="org.macports.openjdk" \ BUNDLE_VENDOR="MacPorts" \ HOTSPOT_BUILD_JOBS="${build.jobs}" # jtreg-based tests test.run yes test.args "JT_HOME=${prefix}/share/java/jtreg" CONCURRENCY="${build.jobs}" {*}${build.args} # Our own tests; they run prior to the JVM's tests. pre-test { set testpath "${workpath}/tests" set build "${worksrcpath}/build/macosx-${openjdk_build_arch}" # Buld the tests file mkdir ${testpath} exec ${build}/bin/javac -d ${testpath} {*}[glob ${filespath}/tests/*.java] # Create the variant list we'll pass to our test cases set variants {} foreach v $PortInfo(variants) { if {[variant_isset $v]} { lappend variants $v } } # Execute foreach class_file [glob -tails -directory ${testpath} *Test.class] { set class [file rootname $class_file] exec ${build}/bin/java -cp ${testpath} ${class} {*}$variants } } # We violate mtree in two ways: # - We install in $prefix/. This has long been a standard path for installed JVMs # and models the approach taken by the FreeBSD Java ports. # - We install a link to our JDK bundle in /Library/Java/JavaVirtualMachines. This is the only # path in which we can register our VMs with Mac OS X. destroot.violate_mtree yes destroot { # Copy in the bundle set target_bundle_name "macports-jdk1.${jdk_major_version}.0_${jport_minor_version}.jdk" set src_bundle_name "jdk1.${jdk_major_version}.0_${jport_minor_version}.jdk" set bundle_path "${prefix}/Library/Java/JavaVirtualMachines/${target_bundle_name}" set destroot_bundle_path "${destroot}${bundle_path}/" xinstall -m 755 -d ${destroot_bundle_path} system "(cd \"${worksrcpath}/build/macosx-${openjdk_build_arch}/j2sdk-bundle/${src_bundle_name}\" && tar cf - *) | (tar -C \"${destroot_bundle_path}\" -xf -)" # Embed the Rhino sources in the bundle set demo_rhino_path ${destroot_bundle_path}/Contents/Home/demo/scripting/rhino xinstall -m 755 -d ${demo_rhino_path} system -W ${rhino_srcpath}/src {zip -r ../src.zip *} xinstall -m 644 ${rhino_srcpath}/README.txt ${rhino_srcpath}/LICENSE ${rhino_srcpath}/src.zip ${demo_rhino_path} # Create a standard path for our Java Home; this is intended to be used by ports (and users) # that don't want to reference the version-and-build-specific bundle path. ln -sf "Library/Java/JavaVirtualMachines/${target_bundle_name}/Contents/Home" "${destroot}${prefix}/${name}" # Add the link to /Library/Java/JavaVirtualMachines xinstall -m 755 -d "${destroot}/Library/Java/JavaVirtualMachines" ln -sf "${bundle_path}" "${destroot}/Library/Java/JavaVirtualMachines/" } livecheck.url http://www.oracle.com/technetwork/java/javase/downloads/index.html livecheck.type regexm livecheck.regex {Java SE (7u[0-9a-z]*)} livecheck.version "${jdk_major_version}u${jport_minor_version}"