changeset 2180:d12fd1d4a26e

Provide a single rule to build all PulseAudio object files without explicit source file names. 2010-02-24 Andrew John Hughes <ahughes@redhat.com> * pulseaudio/src/native/org_classpath_icedtea_pulseaudio_PulseAudioStreamVolumeControl.c: Removed, never built and no corresponding Java source file. * Makefile.am: (PULSE_JAVA_NATIVE_SRCS): List of PulseAudio source files. (PULSE_JAVA_NATIVE_OBJECTS): List of PulseAudio object files. (PULSE_JAVA_TARGET): Optional PulseAudio target. (icedtea.stamp): Replace explicit pulse-java.stamp with PULSE_JAVA_TARGET. (icedtea-debug.stamp): Likewise. (pulse-java.stamp): Depend on compiled library rather than headers target. ($(PULSE_JAVA_NATIVE_BUILDDIR)/%.o): New target to compile object files from source files using make substitution. ($(PULSE_JAVA_NATIVE_BUILDDIR)/libpulse-java.so): New target to build the shared library. (pulse-java-jar.stamp): Make ENABLE_PULSE_JAVA conditional encompass all PulseAudio targets. (pulse-java-class.stamp): Likewise. (pulse-java-headers.stamp): Likewise, and remove unneeded BOOT_DIR conditional (pulse-java-class.stamp now depends on the appropriate bootstrap target). (pulse-java-native-code.stamp): Removed.
author Andrew John Hughes <ahughes@redhat.com>
date Fri, 28 May 2010 17:16:40 +0100
parents 44d5f7a1a79b
children a389f4a8658c
files ChangeLog Makefile.am pulseaudio/src/native/org_classpath_icedtea_pulseaudio_PulseAudioStreamVolumeControl.c
diffstat 3 files changed, 56 insertions(+), 109 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Feb 23 17:36:57 2010 +0000
+++ b/ChangeLog	Fri May 28 17:16:40 2010 +0100
@@ -1,3 +1,31 @@
+2010-02-24 Andrew John Hughes  <ahughes@redhat.com>
+
+	* pulseaudio/src/native/org_classpath_icedtea_pulseaudio_PulseAudioStreamVolumeControl.c:
+	Removed, never built and no corresponding
+	Java source file.
+	* Makefile.am:
+	(PULSE_JAVA_NATIVE_SRCS): List of PulseAudio source
+	files.
+	(PULSE_JAVA_NATIVE_OBJECTS): List of PulseAudio object
+	files.
+	(PULSE_JAVA_TARGET): Optional PulseAudio target.
+	(icedtea.stamp): Replace explicit pulse-java.stamp
+	with PULSE_JAVA_TARGET.
+	(icedtea-debug.stamp): Likewise.
+	(pulse-java.stamp): Depend on compiled library rather than
+	headers target.
+	($(PULSE_JAVA_NATIVE_BUILDDIR)/%.o): New target to compile
+	object files from source files using make substitution.
+	($(PULSE_JAVA_NATIVE_BUILDDIR)/libpulse-java.so): New target
+	to build the shared library.
+	(pulse-java-jar.stamp): Make ENABLE_PULSE_JAVA conditional
+	encompass all PulseAudio targets.
+	(pulse-java-class.stamp): Likewise.
+	(pulse-java-headers.stamp): Likewise, and remove unneeded
+	BOOT_DIR conditional (pulse-java-class.stamp now depends on
+	the appropriate bootstrap target).
+	(pulse-java-native-code.stamp): Removed.
+
 2010-02-23  Gary Benson  <gbenson@redhat.com>
 
 	* ports/hotspot/make/linux/makefiles/shark.make: Whitespace fixes.
--- a/Makefile.am	Tue Feb 23 17:36:57 2010 +0000
+++ b/Makefile.am	Fri May 28 17:16:40 2010 +0100
@@ -205,16 +205,14 @@
 # include the makefile in pulseaudio subdir
 PULSE_JAVA_DIR = $(abs_top_srcdir)/pulseaudio
 PULSE_JAVA_NATIVE_SRCDIR = $(PULSE_JAVA_DIR)/src/native
+PULSE_JAVA_NATIVE_SRCS = $(wildcard $(PULSE_JAVA_NATIVE_SRCDIR)/*.c)
 PULSE_JAVA_BUILDDIR = $(abs_top_builddir)/pulseaudio
 PULSE_JAVA_NATIVE_BUILDDIR = $(PULSE_JAVA_BUILDDIR)/native
+PULSE_JAVA_NATIVE_OBJECTS = \
+	$(subst $(PULSE_JAVA_NATIVE_SRCDIR),$(PULSE_JAVA_NATIVE_BUILDDIR),$(patsubst %.c,%.o,$(PULSE_JAVA_NATIVE_SRCS)))
 PULSE_JAVA_JAVA_SRCDIR = $(PULSE_JAVA_DIR)/src/java
 PULSE_JAVA_CLASS_DIR = $(PULSE_JAVA_BUILDDIR)/classes
-else 
-PULSE_JAVA_DIR =
-PULSE_JAVA_NATIVE_SRCDIR =
-PULSE_JAVA_NATIVE_BUILDDIR =
-PULSE_JAVA_JAVA_SRCDIR =
-PULSE_JAVA_CLASS_DIR =
+PULSE_JAVA_TARGET = stamps/pulse-java.stamp
 endif
 
 # This should not depend on bootstrapping
@@ -1794,7 +1792,7 @@
 stamps/icedtea.stamp: stamps/bootstrap-directory-symlink-stage2.stamp \
  stamps/download.stamp stamps/extract.stamp $(OPENJDK_TREE) \
  stamps/plugin.stamp $(JNLP_ABOUT_TARGET) stamps/cacao.stamp \
- stamps/netx-dist.stamp stamps/liveconnect-dist.stamp stamps/pulse-java.stamp \
+ stamps/netx-dist.stamp stamps/liveconnect-dist.stamp $(PULSE_JAVA_TARGET) \
  stamps/rewrite-rhino.stamp
 	$(ARCH_PREFIX) $(MAKE) \
 	  $(ICEDTEA_ENV) \
@@ -1878,7 +1876,7 @@
 stamps/icedtea-debug.stamp: stamps/bootstrap-directory-symlink-stage2.stamp \
  stamps/download.stamp stamps/extract.stamp $(OPENJDK_TREE) \
  stamps/plugin.stamp $(JNLP_ABOUT_TARGET) stamps/cacao.stamp \
- stamps/netx-dist.stamp stamps/liveconnect-dist.stamp stamps/pulse-java.stamp \
+ stamps/netx-dist.stamp stamps/liveconnect-dist.stamp $(PULSE_JAVA_TARGET) \
  stamps/rewrite-rhino.stamp
 	$(ARCH_PREFIX) $(MAKE) \
 	  $(ICEDTEA_ENV) \
@@ -2213,65 +2211,53 @@
 
 # PulseAudio based mixer
 # (pulse-java)
+if ENABLE_PULSE_JAVA
 
-stamps/pulse-java.stamp: stamps/pulse-java-jar.stamp stamps/pulse-java-native-code.stamp
+stamps/pulse-java.stamp: stamps/pulse-java-jar.stamp $(PULSE_JAVA_NATIVE_BUILDDIR)/libpulse-java.so
 	mkdir -p stamps
 	touch $@
 
 stamps/pulse-java-class.stamp: $(INITIAL_BOOTSTRAP_LINK_STAMP)
-if ENABLE_PULSE_JAVA
 	mkdir -p $(PULSE_JAVA_CLASS_DIR)
 	(cd $(PULSE_JAVA_JAVA_SRCDIR); \
-	 $(ICEDTEA_BOOT_DIR)/bin/javac $(IT_JAVACFLAGS) -d $(PULSE_JAVA_CLASS_DIR)\
+	 $(ICEDTEA_BOOT_DIR)/bin/javac $(IT_JAVACFLAGS) -d $(PULSE_JAVA_CLASS_DIR) \
 	 -bootclasspath '$(ICEDTEA_BOOT_DIR)/jre/lib/rt.jar' \
 	 org/classpath/icedtea/pulseaudio/*.java\
 	)
 	cp  -r $(PULSE_JAVA_JAVA_SRCDIR)/META-INF $(PULSE_JAVA_CLASS_DIR)
 	chmod -R ug+w $(PULSE_JAVA_CLASS_DIR)/META-INF
-endif
 	mkdir -p stamps
 	touch $@
 
 stamps/pulse-java-jar.stamp: stamps/pulse-java-class.stamp
-if ENABLE_PULSE_JAVA
-	mkdir -p $(PULSE_JAVA_CLASS_DIR);
 	$(ICEDTEA_BOOT_DIR)/bin/jar cf pulse-java.jar -C $(PULSE_JAVA_CLASS_DIR) .;
-endif
 	mkdir -p stamps
 	touch $@
 
 stamps/pulse-java-headers.stamp: stamps/pulse-java-class.stamp
-if ENABLE_PULSE_JAVA
-	if ! test -d $(ICEDTEA_BOOT_DIR) ; \
-	then \
-	  $(JAVAH) -d $(PULSE_JAVA_NATIVE_BUILDDIR) -classpath $(PULSE_JAVA_CLASS_DIR) org.classpath.icedtea.pulseaudio.EventLoop ; \
-	  $(JAVAH) -d $(PULSE_JAVA_NATIVE_BUILDDIR) -classpath $(PULSE_JAVA_CLASS_DIR) org.classpath.icedtea.pulseaudio.Stream ; \
-	  $(JAVAH) -d $(PULSE_JAVA_NATIVE_BUILDDIR) -classpath $(PULSE_JAVA_CLASS_DIR) org.classpath.icedtea.pulseaudio.Operation; \
-	  $(JAVAH) -d $(PULSE_JAVA_NATIVE_BUILDDIR) -classpath $(PULSE_JAVA_CLASS_DIR) org.classpath.icedtea.pulseaudio.PulseAudioSourcePort ; \
-	  $(JAVAH) -d $(PULSE_JAVA_NATIVE_BUILDDIR) -classpath $(PULSE_JAVA_CLASS_DIR) org.classpath.icedtea.pulseaudio.PulseAudioTargetPort ; \
-	else \
-	  $(ICEDTEA_BOOT_DIR)/bin/javah -d $(PULSE_JAVA_NATIVE_BUILDDIR) -classpath $(PULSE_JAVA_CLASS_DIR) org.classpath.icedtea.pulseaudio.EventLoop ; \
-	  $(ICEDTEA_BOOT_DIR)/bin/javah -d $(PULSE_JAVA_NATIVE_BUILDDIR) -classpath $(PULSE_JAVA_CLASS_DIR) org.classpath.icedtea.pulseaudio.Stream ; \
-	  $(ICEDTEA_BOOT_DIR)/bin/javah -d $(PULSE_JAVA_NATIVE_BUILDDIR) -classpath $(PULSE_JAVA_CLASS_DIR) org.classpath.icedtea.pulseaudio.Operation; \
-	  $(ICEDTEA_BOOT_DIR)/bin/javah -d $(PULSE_JAVA_NATIVE_BUILDDIR) -classpath $(PULSE_JAVA_CLASS_DIR) org.classpath.icedtea.pulseaudio.PulseAudioSourcePort ; \
-	  $(ICEDTEA_BOOT_DIR)/bin/javah -d $(PULSE_JAVA_NATIVE_BUILDDIR) -classpath $(PULSE_JAVA_CLASS_DIR) org.classpath.icedtea.pulseaudio.PulseAudioTargetPort ; \
-	fi
-endif
+	$(ICEDTEA_BOOT_DIR)/bin/javah -d $(PULSE_JAVA_NATIVE_BUILDDIR) -classpath $(PULSE_JAVA_CLASS_DIR) \
+	  org.classpath.icedtea.pulseaudio.EventLoop ;
+	$(ICEDTEA_BOOT_DIR)/bin/javah -d $(PULSE_JAVA_NATIVE_BUILDDIR) -classpath $(PULSE_JAVA_CLASS_DIR) \
+	  org.classpath.icedtea.pulseaudio.Stream
+	$(ICEDTEA_BOOT_DIR)/bin/javah -d $(PULSE_JAVA_NATIVE_BUILDDIR) -classpath $(PULSE_JAVA_CLASS_DIR) \
+	  org.classpath.icedtea.pulseaudio.Operation
+	$(ICEDTEA_BOOT_DIR)/bin/javah -d $(PULSE_JAVA_NATIVE_BUILDDIR) -classpath $(PULSE_JAVA_CLASS_DIR) \
+	  org.classpath.icedtea.pulseaudio.PulseAudioSourcePort
+	$(ICEDTEA_BOOT_DIR)/bin/javah -d $(PULSE_JAVA_NATIVE_BUILDDIR) -classpath $(PULSE_JAVA_CLASS_DIR) \
+	  org.classpath.icedtea.pulseaudio.PulseAudioTargetPort
 	mkdir -p stamps
 	touch $@
 
-stamps/pulse-java-native-code.stamp: stamps/pulse-java-headers.stamp
-if ENABLE_PULSE_JAVA
+$(PULSE_JAVA_NATIVE_BUILDDIR)/%.o: $(PULSE_JAVA_NATIVE_SRCDIR)/%.c stamps/pulse-java-headers.stamp
 	mkdir -p $(PULSE_JAVA_NATIVE_BUILDDIR)
-	$(CC) $(CFLAGS) -fPIC -c -I$(ICEDTEA_BOOT_DIR)/include/linux -I$(ICEDTEA_BOOT_DIR)/include $(PULSE_JAVA_NATIVE_SRCDIR)/jni-common.c -o $(PULSE_JAVA_NATIVE_BUILDDIR)/jni-common.o
-	$(CC) $(LIBPULSE_CFLAGS) $(CFLAGS) -fPIC -c -I$(ICEDTEA_BOOT_DIR)/include/linux -I$(ICEDTEA_BOOT_DIR)/include -I$(PULSE_JAVA_NATIVE_BUILDDIR) $(PULSE_JAVA_NATIVE_SRCDIR)/org_classpath_icedtea_pulseaudio_EventLoop.c -o $(PULSE_JAVA_NATIVE_BUILDDIR)/org_classpath_icedtea_pulseaudio_EventLoop.o
-	$(CC) $(LIBPULSE_CFLAGS) $(CFLAGS) -fPIC -c -I$(ICEDTEA_BOOT_DIR)/include/linux -I$(ICEDTEA_BOOT_DIR)/include -I$(PULSE_JAVA_NATIVE_BUILDDIR) $(PULSE_JAVA_NATIVE_SRCDIR)/org_classpath_icedtea_pulseaudio_Operation.c -o $(PULSE_JAVA_NATIVE_BUILDDIR)/org_classpath_icedtea_pulseaudio_Operation.o
-	$(CC) $(LIBPULSE_CFLAGS) $(CFLAGS) -fPIC -c -I$(ICEDTEA_BOOT_DIR)/include/linux -I$(ICEDTEA_BOOT_DIR)/include -I$(PULSE_JAVA_NATIVE_BUILDDIR) $(PULSE_JAVA_NATIVE_SRCDIR)/org_classpath_icedtea_pulseaudio_Stream.c -o $(PULSE_JAVA_NATIVE_BUILDDIR)/org_classpath_icedtea_pulseaudio_Stream.o
-	$(CC) $(LIBPULSE_CFLAGS) $(CFLAGS) -fPIC -c -I$(ICEDTEA_BOOT_DIR)/include/linux -I$(ICEDTEA_BOOT_DIR)/include -I$(PULSE_JAVA_NATIVE_BUILDDIR) $(PULSE_JAVA_NATIVE_SRCDIR)/org_classpath_icedtea_pulseaudio_PulseAudioTargetPort.c -o $(PULSE_JAVA_NATIVE_BUILDDIR)/org_classpath_icedtea_pulseaudio_PulseAudioTargetPort.o
-	$(CC) $(LDFLAGS) -shared $(PULSE_JAVA_NATIVE_BUILDDIR)/org_*pulseaudio*.o $(PULSE_JAVA_NATIVE_BUILDDIR)/jni-common.o $(LIBPULSE_LIBS) -o libpulse-java.so
+	$(CC) $(CFLAGS) -fPIC -I$(ICEDTEA_BOOT_DIR)/include/linux -I$(ICEDTEA_BOOT_DIR)/include \
+	 -o $@ -c $<
+
+$(PULSE_JAVA_NATIVE_BUILDDIR)/libpulse-java.so: $(PULSE_JAVA_NATIVE_OBJECTS)
+	$(CC) $(LDFLAGS) -shared $(PULSE_JAVA_NATIVE_OBJECTS) $(LIBPULSE_LIBS) \
+	 -o $(PULSE_JAVA_NATIVE_BUILDDIR)/libpulse-java.so
+
 endif
-	mkdir -p stamps
-	touch $@
 
 clean-pulse-java:
 if ENABLE_PULSE_JAVA
@@ -2845,7 +2831,7 @@
 
 plugs: stamps/plugs.stamp
 
-pulse-java: stamps/pulse-java.stamp
+pulse-java: $(PULSE_JAVA_TARGET)
 
 rt: stamps/rt.stamp
 
--- a/pulseaudio/src/native/org_classpath_icedtea_pulseaudio_PulseAudioStreamVolumeControl.c	Tue Feb 23 17:36:57 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/* org_classpath_icedtea_pulseaudio_PulseAudioStreamVolumeControl.c
- Copyright (C) 2008 Red Hat, Inc.
-
- This file is part of IcedTea.
-
- IcedTea is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as published by
- the Free Software Foundation, version 2.
-
- IcedTea is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with IcedTea; see the file COPYING.  If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301 USA.
-
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library.  Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
-
- As a special exception, the copyright holders of this library give you
- permission to link this library with independent modules to produce an
- executable, regardless of the license terms of these independent
- modules, and to copy and distribute the resulting executable under
- terms of your choice, provided that you also meet, for each linked
- independent module, the terms and conditions of the license of that
- module.  An independent module is a module which is not derived from
- or based on this library.  If you modify this library, you may extend
- this exception to your version of the library, but you are not
- obligated to do so.  If you do not wish to do so, delete this
- exception statement from your version.
- */
-
-#include <jni.h>
-#include <pulse/pulseaudio.h>
-
-#include "jni-common.h"
-#include "org_classpath_icedtea_pulseaudio_PulseAudioStreamVolumeControl.h"
-
-
-extern JNIEnv* pulse_thread_env;
-
-static void set_sink_input_volume_callback(pa_context* context, int success,
-		void* userdata) {
-
-	JNIEnv* env = pulse_thread_env;
-
-	notifyWaitingOperations(env);
-
-}
-
-JNIEXPORT jint JNICALL Java_org_classpath_icedtea_pulseaudio_PulseAudioStreamVolumeControl_native_1setValue
-(JNIEnv *env, jobject obj, jfloat new_volume) {
-	//	printf("IN NATIVE SET VOLUME\n");
-	pa_stream *stream = getJavaPointer(env, obj, "streamPointer");
-	//	printf("STREAM POINTER %d", (int) stream);
-	pa_context *context = pa_stream_get_context(stream);
-	int stream_id = pa_stream_get_index(stream);
-	int channels = pa_stream_get_sample_spec(stream)->channels;
-	pa_cvolume cv;
-	return (jint) pa_context_set_sink_input_volume(context, stream_id, pa_cvolume_set(&cv, channels, new_volume), set_sink_input_volume_callback, NULL);
-}
-