Ticket #22760: Portfile

File Portfile, 6.8 KB (added by vike2000, 14 years ago)
Line 
1# $Id: Portfile 53088 2009-06-29 05:16:32Z ryandesign@macports.org $
2# $Id: Portfile 00000 2009-12-02 00:00:00Z vike2000@gmail.com $
3
4PortSystem 1.0
5
6name                openjdk6
7version             b16
8revision            1
9set builddate 24_apr_2009
10
11categories          java
12maintainers         landonf openmaintainer
13platforms           darwin
14
15homepage            http://openjdk.java.net/
16description         Sun's java 6 virtual machine release under the GNUV2 license
17long_description \
18                    OpenJDK is an open-source implementation of the Java Platform, Standard Edition. \
19                    The version has all of Sun's bug fixes up to JDK 6 Release 11 and should be \
20                    the runtime equivelent to JDK6 Release 11. \
21                    \
22                    Much of the OpenJDK code is licensed under the GPL version 2 with the \
23                    Classpath exception. The Java Hotspot virtual machine source code is \
24                    licensed under the GPL version 2 only.
25
26distname            openjdk-6-src-${version}-${builddate}
27master_sites        http://download.java.net/openjdk/jdk6/promoted/${version}/
28checksums           md5     850a29b70206bc7fa083cd26acc781f3 \
29                    sha256  96159489d8b70db275c125b627c6e6912e6c078279d76b968d2e0969359c9420
30
31patchfiles          patch-set \
32                    patch-null_word_intptr_t \
33                    patch-jdk_src_solaris_javavm_include_typedefs__md.h \
34                    patch-jvm_base_addr \
35                    patch-jdk_src_share_java.c \
36                    patch-jdk_src_solaris_native_common_gdefs__md.h \
37                    patch-10.4-ucontext \
38                    patch-disable_test_gamma
39
40use_configure        no
41
42depends_lib         port:freetype \
43                    port:openmotif \
44                    port:xorg-libX11 \
45                    port:xorg-libXtst
46depends_build       port:icedtea6-plugs \
47                    port:apache-ant
48
49set                                                                                              OTHER_LDFLAGS                                          {}
50
51set                                                                                              bootstrap_apple                                        false
52set                              bootstrap_apple_root                                                                                            "/System/Library/Frameworks/JavaVM.framework"
53variant                  bootstrap_apple description "bootstrap with $bootstrap_apple_root" {
54        depends_build-delete port:openjdk6_bootstrap
55        global           bootstrapvm                    ;set     bootstrapvm                                             "$bootstrap_apple_root/Home"
56        global           OTHER_LDFLAGS                  ;set     OTHER_LDFLAGS          "$OTHER_LDFLAGS -L$bootstrap_apple_root/Libraries"
57        global           bootstrap_apple                ;set     bootstrap_apple                                        true
58        ui_debug                        "$name+bootstrap_apple:setup"
59}
60
61pre-fetch {
62        if [expr !                                                                      $bootstrap_apple] {
63               
64                # Check if the boostrap is required
65                if {[file exists ${prefix}/share/java/openjdk6/bin/java]} {
66                    # A previous OpenJDK6 release is already installed
67                    set bootstrapvm "${prefix}/share/java/openjdk6"
68                } else {
69                        # A bootstrap binary is required to build
70                        depends_build-append port:openjdk6_bootstrap
71                        set bootstrapvm "${prefix}/share/java/openjdk6_bootstrap"
72                }
73                        ui_debug        "$name+bootstrap_apple: ineffective"
74        } else {ui_debug        "$name+bootstrap_apple: effective"}
75}
76
77worksrcdir          "./"
78
79post-extract {
80    set copydirs { \
81        hotspot/src/os/linux/launcher \
82        hotspot/src/os/linux/vm \
83        hotspot/src/os_cpu/linux_x86/vm \
84        hotspot/build/linux \
85        hotspot/build/linux/makefiles \
86        jdk/src/linux/doc/man
87    }
88
89    set copyfiles { \
90        corba/make/common/Defs-linux.gmk \
91        corba/make/common/shared/Defs-linux.gmk \
92        jdk/make/common/Defs-linux.gmk \
93        jdk/make/common/shared/Defs-linux.gmk \
94        jdk/make/java/nio/mapfile-linux \
95        jdk/make/netbeans/common/architectures/name-Linux.properties \
96        jdk/make/sun/awt/mapfile-vers-linux \
97        jdk/make/tools/sharing/classlist.linux \
98        jdk/src/solaris/classes/java/lang/UNIXProcess.java.linux \
99        jdk/src/solaris/classes/sun/awt/fontconfigs/linux.fontconfig.properties \
100        jdk/src/solaris/classes/sun/tools/attach/LinuxAttachProvider.java \
101        jdk/src/solaris/hpi/include/largefile_linux.h \
102        jdk/src/solaris/native/java/net/linux_close.c \
103        jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c
104    }
105
106    # Copy over original Linux sources
107    foreach src ${copydirs} {
108        set dest "${worksrcpath}/[strsed ${src} g/linux/bsd/]"
109
110        # Create the parent directories
111        file mkdir "${dest}"
112
113        # Copy the contents, adjust file contents
114        foreach srcfile [glob -types f "${worksrcpath}/${src}/*"] {
115            set destfile "${dest}/[strsed [file tail ${srcfile}] g/linux/bsd/]"
116            copy "${srcfile}" "${destfile}"
117            reinplace "s/linux/bsd/g; s/Linux/Bsd/g" "${destfile}"
118            reinplace "s/linux/bsd/g; s/Linux/Bsd/g" "${destfile}"
119        }
120    }
121
122    foreach src ${copyfiles} {
123        set dest "${worksrcpath}/[exec echo ${src} | sed {s/linux/bsd/g; s/Linux/Bsd/g}]"
124        copy "${worksrcpath}/${src}" "${dest}"
125        reinplace "s/linux/bsd/g; s/Linux/Bsd/g" "${dest}"
126    }
127
128    # Copy the solaris sources
129    copy "${worksrcpath}/jdk/src/solaris/hpi/native_threads/src/threads_solaris.c" \
130         "${worksrcpath}/jdk/src/solaris/hpi/native_threads/src/threads_bsd.c"
131    reinplace "s/solaris/bsd/g; s/Solaris/Bsd/g" \
132        "${worksrcpath}/jdk/src/solaris/hpi/native_threads/src/threads_bsd.c"
133
134
135    copy "${worksrcpath}/jdk/src/share/lib/security/java.security" \
136         "${worksrcpath}/jdk/src/share/lib/security/java.security-openbsd"
137}
138
139pre-build {
140        global                                                                           bootstrap_apple
141        if                                                                                      $bootstrap_apple {
142                ui_debug                "$name+bootstrap_apple: library linkning: checking"
143                global                                                                   ports_dryrun                   \
144                                                                                                 ui_options                             ;
145                if      {       (       [       expr !  [info exists     ports_dryrun]] || $ports_dryrun !=      yes)
146                        &&              [       expr !  [file exists                                                                             "$bootstrap_apple_root/Libraries/libjava.dylib"]]      }\
147                {       ln -s[          expr    [ui_isset ports_debug]?{v}:{}]                                           "$bootstrap_apple_root/Libraries/libjava.jnilib"       \
148                                                                                                                                                                         "$bootstrap_apple_root/Libraries/libjava.dylib"        }}
149       
150        build.args-append                                       \
151                ALT_BOOTDIR="$bootstrapvm"              \
152                OTHER_LDFLAGS="$OTHER_LDFLAGS"  ;
153}
154
155build.args \
156    ALT_BINARY_PLUGS_PATH="${prefix}/share/java/icedtea6-plugs/jre/lib/rt-closed.jar" \
157    ANT_HOME="${prefix}/share/java/apache-ant" \
158    ALT_FREETYPE_HEADERS_PATH="${prefix}/include" \
159    ALT_FREETYPE_LIB_PATH="${prefix}/lib" \
160    ALT_CUPS_HEADERS_PATH="/usr/include" \
161    ALT_MOTIF_DIR="${prefix}" \
162    ALT_X11_PATH="${prefix}" \
163    ALT_DEVTOOLS_PATH=/usr \
164    ALT_CACERTS_FILE=/System/Library/Frameworks/JavaVM.framework/Home/lib/security/cacerts \
165    NO_DOCS=true \
166    HOTSPOT_BUILD_JOBS=[expr [exec sysctl -n hw.ncpu] - 1]
167
168#       if [info exists OTHER_LDFLAGS]                  {
169#               build.args-append                                       \
170                        OTHER_LDFLAGS="$OTHER_LDFLAGS"  }
171
172destroot {
173    set path "${destroot}${prefix}/share/java/${name}/"
174    xinstall -m 755 -d ${path}
175    system "(cd ${worksrcpath}/build/bsd-i586/j2sdk-image && tar cf - *) | (tar -C ${path} -xf -)"
176}