<rdar://problem/7445645> Merge from Windows-20 branch into trunk
authorsherscher@apple.com <sherscher@apple.com@214c2c4a-bf3b-4dcf-9390-e4dd3010487d>
Mon, 7 Dec 2009 05:56:41 +0000 (05:56 +0000)
committersherscher@apple.com <sherscher@apple.com@214c2c4a-bf3b-4dcf-9390-e4dd3010487d>
Mon, 7 Dec 2009 05:56:41 +0000 (05:56 +0000)
git-svn-id: http://svn.macosforge.org/repository/mDNSResponder/trunk@6875 214c2c4a-bf3b-4dcf-9390-e4dd3010487d

mDNSWindows/Java/Java.vcproj
mDNSWindows/Java/makefile64 [new file with mode: 0644]

index 593175d..1707ac5 100755 (executable)
                        />\r
                </Configuration>\r
                <Configuration\r
-                       Name="Release|Win32"\r
-                       OutputDirectory="Release"\r
-                       IntermediateDirectory="Release"\r
+                       Name="Debug|x64"\r
+                       OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
+                       IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
                        ConfigurationType="0"\r
                        InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
                        >\r
                        <Tool\r
                                Name="VCNMakeTool"\r
-                               BuildCommandLine="nmake /f makefile"\r
-                               ReBuildCommandLine="nmake /f makefile"\r
-                               CleanCommandLine="nmake /f makefile clean"\r
+                               BuildCommandLine="nmake /f makefile64 DEBUG=1"\r
+                               ReBuildCommandLine="nmake /f makefile64 DEBUG=1"\r
+                               CleanCommandLine="nmake /f makefile64 DEBUG=1 clean"\r
                                Output=""\r
                                PreprocessorDefinitions=""\r
                                IncludeSearchPath=""\r
                        />\r
                </Configuration>\r
                <Configuration\r
-                       Name="Debug|x64"\r
-                       OutputDirectory="$(PlatformName)\$(ConfigurationName)"\r
-                       IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="Release"\r
+                       IntermediateDirectory="Release"\r
                        ConfigurationType="0"\r
                        InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"\r
                        >\r
                        <Tool\r
                                Name="VCNMakeTool"\r
-                               BuildCommandLine="nmake /f makefile DEBUG=1"\r
-                               ReBuildCommandLine="nmake /f makefile DEBUG=1"\r
-                               CleanCommandLine="nmake /f makefile DEBUG=1 clean"\r
+                               BuildCommandLine="nmake /f makefile"\r
+                               ReBuildCommandLine="nmake /f makefile"\r
+                               CleanCommandLine="nmake /f makefile clean"\r
                                Output=""\r
                                PreprocessorDefinitions=""\r
                                IncludeSearchPath=""\r
@@ -89,9 +89,9 @@
                        >\r
                        <Tool\r
                                Name="VCNMakeTool"\r
-                               BuildCommandLine="nmake /f makefile"\r
-                               ReBuildCommandLine="nmake /f makefile"\r
-                               CleanCommandLine="nmake /f makefile clean"\r
+                               BuildCommandLine="nmake /f makefile64"\r
+                               ReBuildCommandLine="nmake /f makefile64"\r
+                               CleanCommandLine="nmake /f makefile64 clean"\r
                                Output=""\r
                                PreprocessorDefinitions=""\r
                                IncludeSearchPath=""\r
diff --git a/mDNSWindows/Java/makefile64 b/mDNSWindows/Java/makefile64
new file mode 100644 (file)
index 0000000..e171750
--- /dev/null
@@ -0,0 +1,143 @@
+# -*- tab-width: 4 -*-
+#
+# Copyright (c) 2002-2004 Apple Computer, Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# This Makefile builds a .jar file and accompanying JNI support library
+# containing the DNSSD implementation for Java and support classes.
+#
+# Prior to building Java support, you must build DNSSD.dll.
+#
+# nmake with no arguments builds all production targets.
+# 'nmake DEBUG=1' to build debugging targets.
+# 'nmake clean' or 'nmake clean DEBUG=1' to delete prod/debug objects & targets
+#
+# To run nmake, you may need to set up your PATH correctly, using a script 
+# such as: "\Program Files\Microsoft Visual Studio .NET\Vc7\bin\vcvars32.bat"
+# 
+# The default location of the JDK is \javasdk. You can override this on the
+# command line (e.g. 'nmake JDK=\j2dk1.4.2_03').
+
+############################################################################
+
+COREDIR = ..\..\mDNSCore
+SHAREDDIR = ..\..\mDNSShared
+
+JDK = $(JAVA_HOME)
+
+CC = cl
+RC = rc
+LD = ld
+CP = copy
+RM = del /Q
+RMDIR = rmdir /S /Q
+JAVAC = $(JDK)\bin\javac
+JAVAH = $(JDK)\bin\javah
+JAR = $(JDK)\bin\jar
+CFLAGS_COMMON = -LD -DAUTO_CALLBACKS=0 -I. -I..\.. \
+       -I$(COREDIR) -I$(SHAREDDIR) -I$(JDK)\include -I$(JDK)\include\win32
+
+# Set up diverging paths for debug vs. prod builds
+DEBUG=0
+!if $(DEBUG) == 1
+CFLAGS_DEBUG = -Zi -DMDNS_DEBUGMSGS=2 
+OBJDIR = objects\debug
+BUILDDIR = build\debug
+INSTALLDIR = root\"Program Files"\Bonjour
+LIBDIR = ..\DLL\x64\Debug
+!else
+CFLAGS_DEBUG = -Os -DMDNS_DEBUGMSGS=0 
+OBJDIR = objects\prod
+BUILDDIR = build\prod
+INSTALLDIR = root\"Program Files"\Bonjour
+LIBDIR = ..\DLL\x64\Release
+!endif
+
+CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_DEBUG)
+JAVACFLAGS = $(CFLAGS) $(JAVACFLAGS_OS)
+
+#############################################################################
+
+all: setup Java postbuild
+
+# 'setup' sets up the build directory structure the way we want
+setup:
+       @if not exist objects           mkdir objects
+       @if not exist build                     mkdir build
+       @if not exist $(OBJDIR)         mkdir $(OBJDIR)
+       @if not exist $(BUILDDIR)       mkdir $(BUILDDIR)
+
+postbuild:
+       @if not "%RC_XBS%"=="YES" GOTO CONT
+       @if not exist "$(DSTROOT)\WINDOWS\system32\x64" mkdir "$(DSTROOT)\WINDOWS\system32\x64"
+       @if not exist "$(DSTROOT)\Program Files\Bonjour\x64"    mkdir "$(DSTROOT)\Program Files\Bonjour\x64"
+       @copy $(BUILDDIR)\jdns_sd.dll "$(DSTROOT)\WINDOWS\system32\x64"
+       @copy $(BUILDDIR)\dns_sd.jar  "$(DSTROOT)\Program Files\Bonjour\x64"
+       @:CONT
+       @if not exist root                                      mkdir root
+       @if not exist root\"Program Files"      mkdir root\"Program Files"
+       @if not exist $(INSTALLDIR)                     mkdir $(INSTALLDIR)
+       copy $(BUILDDIR)\dns_sd.jar $(INSTALLDIR)
+       copy $(BUILDDIR)\jdns_sd.dll $(INSTALLDIR)
+
+# clean removes targets and objects
+clean:
+       @if exist $(OBJDIR)             $(RMDIR) $(OBJDIR)
+       @if exist $(BUILDDIR)   $(RMDIR) $(BUILDDIR)
+
+#############################################################################
+
+# The following targets build Java wrappers for the dns-sd.h API.
+
+Java: setup $(BUILDDIR)\dns_sd.jar $(BUILDDIR)\jdns_sd.dll postbuild
+       @echo "Java wrappers done"
+
+JAVASRC        = $(SHAREDDIR)\Java
+JARCONTENTS =  $(OBJDIR)\com\apple\dnssd\DNSSDService.class \
+                               $(OBJDIR)\com\apple\dnssd\DNSSDException.class \
+                               $(OBJDIR)\com\apple\dnssd\DNSRecord.class \
+                               $(OBJDIR)\com\apple\dnssd\TXTRecord.class \
+                               $(OBJDIR)\com\apple\dnssd\DNSSDRegistration.class \
+                               $(OBJDIR)\com\apple\dnssd\DNSSDRecordRegistrar.class \
+                               $(OBJDIR)\com\apple\dnssd\BaseListener.class \
+                               $(OBJDIR)\com\apple\dnssd\BrowseListener.class \
+                               $(OBJDIR)\com\apple\dnssd\ResolveListener.class \
+                               $(OBJDIR)\com\apple\dnssd\RegisterListener.class \
+                               $(OBJDIR)\com\apple\dnssd\RegisterRecordListener.class \
+                               $(OBJDIR)\com\apple\dnssd\QueryListener.class \
+                               $(OBJDIR)\com\apple\dnssd\DomainListener.class \
+                               $(OBJDIR)\com\apple\dnssd\DNSSD.class
+
+$(BUILDDIR)\dns_sd.jar: $(JARCONTENTS)
+       $(JAR) -cf $@ -C $(OBJDIR) com
+
+$(BUILDDIR)\jdns_sd.dll: $(JAVASRC)\JNISupport.c $(OBJDIR)\DNSSD.java.h $(OBJDIR)\jdns_sd.RES
+       $(CC) -Fe$@ $(JAVASRC)\JNISupport.c $(CFLAGS) -I$(OBJDIR) \
+       $(LIBDIR)\DNSSD.lib $(JDK)\lib\jvm.lib ws2_32.lib iphlpapi.lib $(OBJDIR)\jdns_sd.RES /link /NXCOMPAT /DYNAMICBASE
+
+.SUFFIXES : .java
+{$(JAVASRC)}.java{$(OBJDIR)\com\apple\dnssd}.class:    
+       $(JAVAC) -d $(OBJDIR) -classpath $(OBJDIR) $<
+
+$(OBJDIR)\DNSSD.java.h: $(OBJDIR)\com\apple\dnssd\DNSSD.class
+       $(JAVAH) -classpath $(OBJDIR) -o $@ \
+               com.apple.dnssd.AppleBrowser \
+               com.apple.dnssd.AppleResolver \
+               com.apple.dnssd.AppleRegistration \
+               com.apple.dnssd.AppleQuery \
+               com.apple.dnssd.AppleService 
+
+$(OBJDIR)\jdns_sd.RES: jdns_sd.rc
+       $(RC) /fo $@ $?
+