diff --git a/dev-lang/openjdk/openjdk-1.7.bep b/dev-lang/openjdk/openjdk-1.7.bep index 23b851578..da068202f 100644 --- a/dev-lang/openjdk/openjdk-1.7.bep +++ b/dev-lang/openjdk/openjdk-1.7.bep @@ -1,21 +1,20 @@ -DESCRIPTION="openjdk" -HOMEPAGE="http://openjdk.java.net" +DESCRIPTION="openjdk" +HOMEPAGE="http://openjdk.java.net/" SRC_URI="http://ports-space.haiku-files.org/dev-lang/j2sdk-july-r2.tar.xz" REVISION="1" -STATUS_HAIKU="broken" -DEPEND="app-arch/cpio >= 2.10 - media-libs/freetype >= 2.4.6" -MESSAGE="This port only builds with gcc4. Use 'setgcc gcc4' before building." +STATUS_HAIKU="stable" +DEPEND="app-arch/cpio >= 2.10 + media-libs/freetype >= 2.4.6" + CHECKSUM_MD5="28b8630373769e1e897a75bf81f2e1eb" BUILD { - OPENJDK_DIR=`haikuporter -t`/dev-lang/openjdk/work/openjdk-1.7 - mkdir -p openjdk-1.7 - cd openjdk-1.7 - cp -r ../j2sdk-image ${OPENJDK_DIR}/j2sdk-image - - # get and build ant - wget http://archive.apache.org/dist/ant/source/apache-ant-1.8.4-src.tar.gz + OPENJDK_DIR=`haikuporter -t`/dev-lang/openjdk/work + + # Get and build Apache Ant. + # Making a separate .bep file for it wasn't such a good idea. + + wget -nc http://archive.apache.org/dist/ant/source/apache-ant-1.8.4-src.tar.gz tar xvfz apache-ant-1.8.4-src.tar.gz export LIBRARY_PATH=${OPENJDK_DIR}/j2sdk-image/jre/lib/i386/:$LIBRARY_PATH export JAVA_HOME=${OPENJDK_DIR}/j2sdk-image @@ -26,33 +25,75 @@ BUILD { unset JAVA_HOME cd .. - hg clone https://bitbucket.org/hamishm/haiku-jdk jdk - hg clone https://bitbucket.org/hamishm/haiku-jdk-langtools jdk/langtools - hg clone https://bitbucket.org/hamishm/haiku-jdk-hotspot jdk/hotspot - hg clone https://bitbucket.org/hamishm/haiku-jdk-jaxp jdk/jaxp - hg clone https://bitbucket.org/hamishm/haiku-jdk-jaxws jdk/jaxws - hg clone https://bitbucket.org/hamishm/haiku-jdk-corba jdk/corba - hg clone https://bitbucket.org/hamishm/haiku-jdk-jdk jdk/jdk - + # Clone latest JDK repositories. + + hg clone http://hg.openjdk.java.net/haiku/haiku jdk --debug + hg clone http://hg.openjdk.java.net/haiku/haiku/corba jdk/corba --debug + hg clone http://hg.openjdk.java.net/haiku/haiku/hotspot jdk/hotspot --debug + hg clone http://hg.openjdk.java.net/haiku/haiku/jaxp jdk/jaxp --debug + hg clone http://hg.openjdk.java.net/haiku/haiku/jaxws jdk/jaxws --debug + hg clone http://hg.openjdk.java.net/haiku/haiku/jdk jdk/jdk --debug + hg clone http://hg.openjdk.java.net/haiku/haiku/langtools jdk/langtools --debug + export ALT_BOOTDIR=${OPENJDK_DIR}/j2sdk-image - export ALT_JDK_IMPORT_PATH=${OPENJDK_DIR}/j2sdk-image' - export ANT=${OPENJDK_DIR}/ant' - mkdir -p ${OPENJDK_DIR}/output - export ALT_OUTPUTDIR=${OPENJDK_DIR}/output' - export ALLOW_DOWNLOADS='true' - make + export ALT_JDK_IMPORT_PATH=${OPENJDK_DIR}/j2sdk-image + export ANT=${OPENJDK_DIR}/ant + export ALT_OUTPUTDIR=${OPENJDK_DIR}/output + mkdir -p ${ALT_OUTPUTDIR} + export ALLOW_DOWNLOADS=true + + # Deploy certain headers, if they are missing. + + HEADERS_DIR=`finddir B_SYSTEM_HEADERS_DIRECTORY` + MEDIA_DIR=${HEADERS_DIR}/os/media + + if [ -e ${MEDIA_DIR}/SoundConsumer.h ] ; + then + echo SoundConsumer.h exists. + else + cp SoundConsumer.h ${MEDIA_DIR}/SoundConsumer.h + SOUND_CONSUMER_H=1 + echo SoundConsumer.h was not found. Deployed private file instead. + fi + + if [ -e ${MEDIA_DIR}/SoundUtils.h ] ; + then + echo SoundUtils.h exists. + else + cp SoundUtils.h ${MEDIA_DIR}/SoundUtils.h + declare SOUND_UTILS_H=1 + echo SoundUtils.h was not found. Deployed private file instead. + fi + + # Build. + + cd jdk + make NO_DOCS=true + + # Cleanup private files, if any were deployed. + # I don't really think it would harm anyone if we don't clean them up after compiling. + +# if [ ${SOUND_CONSUMER_H} == 1 ] ; +# then +# rm -f ${MEDIA_DIR}/SoundConsumer.h +# echo Removed private SoundConsumer.h +# fi +# +# if [ ${SOUND_UTILS_H} == 1 ] ; +# then +# rm -f ${MEDIA_DIR}/SoundUtils.h +# echo Removed private SoundUtils.h +# fi } INSTALL { - cd openjdk-1.7 - make install + export DESTDIR=`finddir B_COMMON_DIRECTORY` + cp -r -f -v output ${DESTDIR}/jdk } TEST { - cd openjdk-1.7 -# make test -# make check + echo "OpenJDK tests are not yet ported to Haiku." } -#LICENSE="" -#COPYRIGHT="" +LICENSE="GNU GPL v2" +COPYRIGHT="2005, 2006, Oracle and/or its affiliates" diff --git a/dev-lang/openjdk/patches/openjdk-1.7.patch b/dev-lang/openjdk/patches/openjdk-1.7.patch new file mode 100644 index 000000000..789216196 --- /dev/null +++ b/dev-lang/openjdk/patches/openjdk-1.7.patch @@ -0,0 +1,213 @@ +--- /dev/null 2012-12-19 09:59:04.122365000 +0200 ++++ SoundConsumer.h 2012-12-04 04:36:51.000000000 +0200 +@@ -0,0 +1,151 @@ ++/******************************************************************************* ++/ ++/ File: SoundConsumer.h ++/ ++/ Description: Record sound from some sound-producing Node. ++/ ++/ Copyright 1998, Be Incorporated, All Rights Reserved ++/ ++*******************************************************************************/ ++#ifndef SOUND_CONSUMER_H ++#define SOUND_CONSUMER_H ++ ++// To use this Consumer: ++// 1. Create Record and Notify hooks, or subclass SoundConsumer ++// if you'd rather use the inheritance hierarchy. ++// * The Record function should do whatever you want to do ++// when you receive a buffer. ++// * The Notify function should handle whatever events ++// you wish to handle (defined in SoundUtil.h). ++// 2: Create an instance of SoundConsumer, giving it the ++// appropriate hook functions. Or, create an instance of an ++// appropriate subclass if you've made one. ++// 3: Register your new Consumer with the MediaRoster. ++// 4: Connect your Consumer to some Producer. ++// 5: Start or Stop the Consumer if your hook functions ++// implement behavior for these kinds of events. ++// Seek the Consumer to set the offset of the timestamps that ++// your Record function will see. ++// 6: When you're done, disconnect the Consumer, then delete it. ++ ++#include ++#include "SoundUtils.h" ++ ++namespace BPrivate { ++ ++ ++class SoundConsumer : public BBufferConsumer { ++public: ++ SoundConsumer(const char* name, ++ SoundProcessFunc recordFunc = NULL, ++ SoundNotifyFunc notifyFunc = NULL, ++ void* cookie = NULL); ++ virtual ~SoundConsumer(); ++ ++ //This function is OK to call from any thread. ++ status_t SetHooks(SoundProcessFunc recordFunc = NULL, ++ SoundNotifyFunc notifyFunc = NULL, ++ void* cookie = NULL); ++ ++ // The MediaNode interface ++public: ++ virtual port_id ControlPort() const; ++ virtual BMediaAddOn* AddOn(int32* internalID) const; ++ // Who instantiated you -- or NULL for app class ++ ++ ++protected: ++ virtual void Start(bigtime_t performanceTime); ++ virtual void Stop(bigtime_t performanceTime, bool immediate); ++ virtual void Seek(bigtime_t mediaTime, ++ bigtime_t performanceTime); ++ virtual void SetRunMode(run_mode mode); ++ virtual void TimeWarp(bigtime_t atRealTime, ++ bigtime_t to_performanceTime); ++ virtual void Preroll(); ++ virtual void SetTimeSource(BTimeSource* timeSource); ++ virtual status_t HandleMessage(int32 message, const void* data, ++ size_t size); ++ ++ // The BufferConsumer interface ++ virtual status_t AcceptFormat(const media_destination& dest, ++ media_format* format); ++ virtual status_t GetNextInput(int32* cookie, ++ media_input* _input); ++ virtual void DisposeInputCookie(int32 cookie); ++ virtual void BufferReceived(BBuffer* buffer); ++ virtual void ProducerDataStatus( ++ const media_destination& forWhom, ++ int32 status, bigtime_t atMediaTime); ++ virtual status_t GetLatencyFor(const media_destination& forWhom, ++ bigtime_t* _latency, ++ media_node_id* _timesource); ++ virtual status_t Connected(const media_source& producer, ++ const media_destination& where, ++ const media_format& format, ++ media_input* _input); ++ virtual void Disconnected(const media_source& producer, ++ const media_destination& where); ++ virtual status_t FormatChanged(const media_source& producer, ++ const media_destination& consumer, ++ int32 fromChangeCount, ++ const media_format& format); ++ ++protected: ++ // Functions called when no hooks are installed. ++ // OK to override instead of installing hooks. ++ virtual void Record(bigtime_t time, const void* data, ++ size_t size, ++ const media_raw_audio_format& format); ++ virtual void Notify(int32 cause, ...); ++ ++private: ++ SoundProcessFunc m_recordHook; ++ SoundNotifyFunc m_notifyHook; ++ void* m_cookie; ++ media_input m_input; ++ thread_id m_thread; ++ port_id m_port; ++ ++ // The times we need to deal with ++ // My notation for times: tr = real time, ++ // tp = performance time, tm = media time. ++ bigtime_t m_trTimeout; ++ // how long to wait on the input port ++ bigtime_t m_tpSeekAt; ++ // when we Seek ++ bigtime_t m_tmSeekTo; ++ // target time for Seek ++ ++ // The transformation from media to peformance time. ++ // d = p - m, so m + d = p. ++ // Media time is generally governed by the Seek ++ // function. In our node, we simply use media time as ++ // the time that we report to the record hook function. ++ // If we were a producer node, we might use media time ++ // to track where we were in playing a certain piece ++ // of media. But we aren't. ++ bigtime_t m_delta; ++ ++ // State variables ++ bool m_seeking; ++ // a Seek is pending ++ ++ // Functions to calculate timing values. OK to override. ++ // ProcessingLatency is the time it takes to process a buffer; ++ // TotalLatency is returned to producer; Timeout is passed ++ // to call to read_port_etc() in service thread loop. ++ virtual bigtime_t Timeout(); ++ virtual bigtime_t ProcessingLatency(); ++ virtual bigtime_t TotalLatency(); ++ // The actual thread doing the work ++ static status_t ThreadEntry(void* cookie); ++ void ServiceThread(); ++ void DoHookChange(void* message); ++}; ++ ++ ++} ++ ++ ++#endif // SOUND_CONSUMER_H +--- /dev/null 2012-12-19 09:59:04.122365000 +0200 ++++ SoundUtils.h 2012-12-04 04:36:51.000000000 +0200 +@@ -0,0 +1,56 @@ ++/******************************************************************************* ++/ ++/ File: SoundUtils.h ++/ ++/ Description: Utility functions for handling audio data. ++/ ++/ Copyright 1998-1999, Be Incorporated, All Rights Reserved ++/ ++*******************************************************************************/ ++ ++#if ! defined( _SoundUtils_h ) ++#define _SoundUtils_h ++ ++#include ++ ++// Simple helper functions that come in handy when doing ++// buffer calculations. ++double us_to_s(bigtime_t usecs); ++bigtime_t s_to_us(double secs); ++ ++int bytes_per_frame(const media_raw_audio_format & format); ++int frames_per_buffer(const media_raw_audio_format & format); ++bigtime_t buffer_duration(const media_raw_audio_format & format); ++bigtime_t frames_duration(const media_raw_audio_format & format, ++ int64 num_frames); ++int64 frames_for_duration(const media_raw_audio_format & format, ++ bigtime_t duration); ++int buffers_for_duration(const media_raw_audio_format & format, ++ bigtime_t duration); ++ ++// This is a common hook function interface for ++// SoundConsumer and SoundProducer to use. ++typedef void (*SoundProcessFunc)(void * cookie, ++ bigtime_t timestamp, void * data, size_t datasize, ++ const media_raw_audio_format & format); ++typedef void (*SoundNotifyFunc)(void * cookie, ++ int32 code, ...); ++ ++// These are special codes that we use in the Notify ++// function hook. ++enum { ++ B_WILL_START = 1, // performance_time ++ B_WILL_STOP, // performance_time immediate ++ B_WILL_SEEK, // performance_time media_time ++ B_WILL_TIMEWARP, // real_time performance_time ++ B_CONNECTED, // name (char*) ++ B_DISCONNECTED, // ++ B_FORMAT_CHANGED, // media_raw_audio_format* ++ B_NODE_DIES, // node will die! ++ B_HOOKS_CHANGED, // ++ B_OP_TIMED_OUT, // timeout that expired -- Consumer only ++ B_PRODUCER_DATA_STATUS, // status performance_time -- Consumer only ++ B_LATE_NOTICE // how_much performance_time -- Producer only ++}; ++ ++#endif /* _SoundUtils_h */