Updated Makefile for jni/mac to reflect the new structure. Added neccessary WebKit 418.9 headers to a sdk directory in tools. Updated license header in native files in jni/mac. Renamed gwt-bootstrap.cpp to gwt-args.cpp. Changed libgwt-ll build rule to compile in core/gwt-ll.cpp. git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@115 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/jni/mac/DispWrapper.cpp b/jni/mac/DispWrapper.cpp index 68eb09f..98f058e 100644 --- a/jni/mac/DispWrapper.cpp +++ b/jni/mac/DispWrapper.cpp
@@ -1,6 +1,18 @@ -// Copyright 2005 Google Inc. -// All Rights Reserved. - +/* + * Copyright 2006 Google Inc. + * + * 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. + */ #include "DispWrapper.h" #include "FunctionObject.h"
diff --git a/jni/mac/DispWrapper.h b/jni/mac/DispWrapper.h index 4eed813..8ed5b7c 100644 --- a/jni/mac/DispWrapper.h +++ b/jni/mac/DispWrapper.h
@@ -1,6 +1,18 @@ -// Copyright 2005 Google Inc. -// All Rights Reserved. - +/* + * Copyright 2006 Google Inc. + * + * 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. + */ #ifndef DISP_WRAPPER_H #define DISP_WRAPPER_H
diff --git a/jni/mac/FuncWrapper.cpp b/jni/mac/FuncWrapper.cpp index e44ca03..76dcaa8 100644 --- a/jni/mac/FuncWrapper.cpp +++ b/jni/mac/FuncWrapper.cpp
@@ -1,6 +1,18 @@ -// Copyright 2005 Google Inc. -// All Rights Reserved. - +/* + * Copyright 2006 Google Inc. + * + * 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. + */ #include "FuncWrapper.h" #include <kjs/array_object.h>
diff --git a/jni/mac/FuncWrapper.h b/jni/mac/FuncWrapper.h index 8019754..f129ded 100644 --- a/jni/mac/FuncWrapper.h +++ b/jni/mac/FuncWrapper.h
@@ -1,6 +1,18 @@ -// Copyright 2005 Google Inc. -// All Rights Reserved. - +/* + * Copyright 2006 Google Inc. + * + * 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. + */ #ifndef FUNC_WRAPPER_H #define FUNC_WRAPPER_H
diff --git a/jni/mac/FunctionObject.cpp b/jni/mac/FunctionObject.cpp index 8e013cd..eac0403 100644 --- a/jni/mac/FunctionObject.cpp +++ b/jni/mac/FunctionObject.cpp
@@ -1,6 +1,18 @@ -// Copyright 2005 Google Inc. -// All Rights Reserved. - +/* + * Copyright 2006 Google Inc. + * + * 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. + */ #include "FunctionObject.h" #include <kjs/array_object.h>
diff --git a/jni/mac/FunctionObject.h b/jni/mac/FunctionObject.h index 0860f5b..4d6fa4e 100644 --- a/jni/mac/FunctionObject.h +++ b/jni/mac/FunctionObject.h
@@ -1,6 +1,18 @@ -// Copyright 2005 Google Inc. -// All Rights Reserved. - +/* + * Copyright 2006 Google Inc. + * + * 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. + */ #ifndef FUNCTION_OBJECT_H #define FUNCTION_OBJECT_H
diff --git a/jni/mac/JStringWrap.h b/jni/mac/JStringWrap.h index 2bb5c35..9d2c306 100644 --- a/jni/mac/JStringWrap.h +++ b/jni/mac/JStringWrap.h
@@ -1,6 +1,18 @@ -// Copyright 2005 Google Inc. -// All Rights Reserved. - +/* + * Copyright 2006 Google Inc. + * + * 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. + */ #ifndef JSTRINGWRAP_H #define JSTRINGWRAP_H
diff --git a/jni/mac/Makefile b/jni/mac/Makefile index ea0cf31..8b11cdf 100644 --- a/jni/mac/Makefile +++ b/jni/mac/Makefile
@@ -1,31 +1,103 @@ -# NOTE: THIS MAKEFILE DOES NOT WORK IN OUR BUILD SYSTEM. IT IS USED -# TO DO THE ISOLATED BUILD OF THE MAC LIBS AND DEPENDS ON A DIFFERENT -# DIRECTORY STRUCTURE. IT IS PUT HERE FOR ARCHIVE ONLY. +# Copyright 2006 Google Inc. +# +# 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. -GWT_LIB=../dist/libgwt-ll.jnilib +## +# External WebKit products. +## +WEBKIT_REDIST=$(GWT_TOOLS)/redist/webkit/WebKit-418.9.tar.gz +WEBKIT_INCLUDE=$(GWT_TOOLS)/sdk/webkit +## +# Built products. +## +GWT_LL_LIB=libgwt-ll.jnilib +GWT_WEBKIT_LIB=libgwt-webkit.jnilib + +## +# Tools. +## CC = g++ +TAR = tar +FIX_INSTALL_NAME = ./fix-install-name.sh +SHELL = /bin/sh + +## +# Compile configuration. +## ARCHS = -arch i386 -arch ppc -CFLAGS = -Wall -c $(ARCHS) -DCARBON -I /System/Library/Frameworks/JavaVM.framework/Headers -fno-exceptions -fno-rtti +CFLAGS = -Wall -c $(ARCHS) -DCARBON -I/System/Library/Frameworks/JavaVM.framework/Headers -fno-exceptions -fno-rtti LFLAGS = -bundle $(ARCHS) -isysroot /Developer/SDKs/MacOSX10.4u.sdk -WEBKITCFLAGS = $(CFLAGS) -I../WebKit-15921/JavaScriptCore -WEBKITLFLAGS = $(LFLAGS) -framework JavaScriptCore -F../dist/Frameworks -GWT_OBJECTS = gwt-ll.o -WEBKIT_OBJECTS = gwt-webkit.o DispWrapper.o FuncWrapper.o FunctionObject.o -all: $(GWT_LIB) +## +# JavaScriptCore options. +## +JSCORE_CFLAGS = $(CFLAGS) -I$(WEBKIT_INCLUDE)/JavaScriptCore +JSCORE_LFLAGS = $(LFLAGS) -framework JavaScriptCore -F./Frameworks +JSCORE_INSTALL_NAME = "@loader_path/Frameworks/JavaScriptCore.framework/Versions/A/JavaScriptCore" +## +# Intermediates +## +GWT_LL_OBJECTS = gwt-ll.o gwt-args.o +GWT_WEBKIT_OBJECTS = gwt-webkit.o DispWrapper.o FuncWrapper.o FunctionObject.o + +#------------------------------------------------------------------------------- +# Rules +#------------------------------------------------------------------------------- + +## +# Default rule. +## +all: $(GWT_LL_LIB) $(GWT_WEBKIT_LIB) + +## +# Copy WebKit binary frameworks locally. +## +Frameworks: $(WEBKIT_REDIST) + $(TAR) -zxvf $(WEBKIT_REDIST) + +## +# Rule for cpp files. +## %.o: %.cpp - $(CC) -c -o $@ $< $(WEBKITCFLAGS) + $(CC) -c -o $@ $< $(JSCORE_CFLAGS) -gwt-ll.o: ../gwt-ll-core/gwt-ll.cpp - $(CC) $(CFLAGS) gwt-ll.cpp +## +# Rule for gwt-ll objects. +## +gwt-ll.o: ../core/gwt-ll.cpp + $(CC) -c -o gwt-ll.o $(CFLAGS) ../core/gwt-ll.cpp -$(GWT_LIB): $(GWT_OBJECTS) $(WEBKIT_OBJECTS) - $(CC) -o $(WEBKIT_LIB) $(WEBKITLFLAGS) $(WEBKIT_OBJECTS) +gwt-args.o: gwt-args.cpp + $(CC) -c -o gwt-args.o $(CFLAGS) gwt-args.cpp -install: all - cp *.jnilib $(OUTPUT_DIR) +## +# Rule for final lib for gwt-ll. +## +$(GWT_LL_LIB): $(GWT_LL_OBJECTS) + $(CC) -o $(GWT_LL_LIB) $(LFLAGS) $(GWT_LL_OBJECTS) +## +# Rule for final lib for gwt-webkit. +## +$(GWT_WEBKIT_LIB): Frameworks $(GWT_WEBKIT_OBJECTS) + $(CC) -o $(GWT_WEBKIT_LIB) $(JSCORE_LFLAGS) $(GWT_WEBKIT_OBJECTS) + $(SHELL) $(FIX_INSTALL_NAME) $(JSCORE_INSTALL_NAME) + +## +# Clean rule. +## clean: - rm -f $(GWT_LIB) $(WEBKIT_LIB) *.o + @-rm -f $(GWT_LL_LIB) $(GWT_WEBKIT_LIB) *.o + @-rm -rf ./Frameworks
diff --git a/jni/mac/fix-install-name.sh b/jni/mac/fix-install-name.sh new file mode 100644 index 0000000..934e4ef --- /dev/null +++ b/jni/mac/fix-install-name.sh
@@ -0,0 +1,35 @@ +#!/bin/sh +# Copyright 2006 Google Inc. +# +# 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. + +JNILIB=libgwt-webkit.jnilib +JSCORE_FRAMEWORK=./Frameworks/JavaScriptCore.framework + +if [ $# -ne 1 ]; then + echo 1>&2 "usage: fix-install-path new_install_path" + exit 1 +fi + +if [ ! -f ${JNILIB} ]; then + echo 1>&2 "Unable to locate: ${JNILIB}" + exit 1 +fi + +if [ ! -d ${JSCORE_FRAMEWORK} ]; then + echo 1>&2 "Unable to locate: ${JNILIB}" + exit 1 +fi + +CURRENT_NAME=`otool -D ${JSCORE_FRAMEWORK}/Versions/A/JavaScriptCore | tail -n 1` +install_name_tool -change "${CURRENT_NAME}" "$1" ${JNILIB}
diff --git a/jni/mac/gwt-args.cpp b/jni/mac/gwt-args.cpp new file mode 100644 index 0000000..4ab3ffa --- /dev/null +++ b/jni/mac/gwt-args.cpp
@@ -0,0 +1,46 @@ +/* + * Copyright 2006 Google Inc. + * + * 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. + */ +#include "gwt-ll.h" +#include "JStringWrap.h" + +// http://unixjunkie.blogspot.com/2006/07/access-argc-and-argv-from-anywhere.html +extern "C" int *_NSGetArgc(void); +extern "C" char ***_NSGetArgv(void); + +/* + * Class: com_google_gwt_dev_shell_mac_LowLevelSaf + * Method: _getArgc + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1getArgc + (JNIEnv* env , jclass) { + return *_NSGetArgc(); +} + +/* + * Class: com_google_gwt_dev_shell_mac_LowLevelSaf + * Method: _getArgv + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_com_google_gwt_dev_shell_mac_LowLevelSaf__1getArgv + (JNIEnv* env, jclass, jint i) { + int argc = *_NSGetArgc(); + if (i < 0 || i >= argc) { + return 0; + } + char **argv = *_NSGetArgv(); + return env->NewStringUTF(argv[i]); +}
diff --git a/jni/mac/gwt-webkit.cpp b/jni/mac/gwt-webkit.cpp index ec2dfaf..ce5a797 100644 --- a/jni/mac/gwt-webkit.cpp +++ b/jni/mac/gwt-webkit.cpp
@@ -1,6 +1,18 @@ -// Copyright 2005 Google Inc. -// All Rights Reserved. - +/* + * Copyright 2006 Google Inc. + * + * 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. + */ #include "gwt-ll.h" #include "DispWrapper.h" #include "FuncWrapper.h"
diff --git a/jni/mac/gwt-webkit.h b/jni/mac/gwt-webkit.h index 88db9f7..3ba982b 100644 --- a/jni/mac/gwt-webkit.h +++ b/jni/mac/gwt-webkit.h
@@ -1,6 +1,18 @@ -// Copyright 2005 Google Inc. -// All Rights Reserved. - +/* + * Copyright 2006 Google Inc. + * + * 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. + */ #ifndef GWT_WEBKIT_H #define GWT_WEBKIT_H