aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--build.zig18
-rw-r--r--examples/hello-create-react-app/src/App.jsx25
-rw-r--r--examples/hello-create-react-app/src/index.jsx17
4 files changed, 54 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index dbd8562fe..80aae5f1d 100644
--- a/Makefile
+++ b/Makefile
@@ -36,7 +36,7 @@ jsc-copy-headers:
find src/JavaScript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/Headers/JavaScriptCore/ -name "*.h" -exec cp {} src/JavaScript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/PrivateHeaders/JavaScriptCore \;
jsc-build-mac-compile:
- cd src/javascript/jsc/WebKit && ICU_INCLUDE_DIRS="/usr/local/opt/icu4c/include" ./Tools/Scripts/build-jsc --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON -DCMAKE_BUILD_TYPE=relwithdebinfo -DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" && echo "Ignore the \"has no symbols\" errors"
+ cd src/javascript/jsc/WebKit && ICU_INCLUDE_DIRS="$(brew --prefix)opt/icu4c/include" ./Tools/Scripts/build-jsc --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON -DCMAKE_BUILD_TYPE=relwithdebinfo && echo "Ignore the \"has no symbols\" errors"
jsc-build-linux-compile:
cd src/javascript/jsc/WebKit && ./Tools/Scripts/build-jsc --jsc-only --cmakeargs="-DENABLE_STATIC_JSC=ON -DCMAKE_BUILD_TYPE=relwithdebinfo
diff --git a/build.zig b/build.zig
index 4514d2cd7..4e1798155 100644
--- a/build.zig
+++ b/build.zig
@@ -215,16 +215,20 @@ pub fn build(b: *std.build.Builder) void {
// step.single_threaded = single_threaded;
- // We must link ICU statically
- step.addObjectFile("/usr/local/opt/icu4c/lib/libicudata.a");
- step.addObjectFile("/usr/local/opt/icu4c/lib/libicui18n.a");
- step.addObjectFile("/usr/local/opt/icu4c/lib/libicuuc.a");
-
if (target.getOsTag() == .macos) {
+ const homebrew_prefix = comptime if (std.Target.current.cpu.arch == .aarch64)
+ "/opt/homebrew/"
+ else
+ "/usr/local/";
+
+ // We must link ICU statically
+ step.addObjectFile(homebrew_prefix ++ "opt/icu4c/lib/libicudata.a");
+ step.addObjectFile(homebrew_prefix ++ "opt/icu4c/lib/libicui18n.a");
+ step.addObjectFile(homebrew_prefix ++ "opt/icu4c/lib/libicuuc.a");
// icucore is a weird macOS only library
step.linkSystemLibrary("icucore");
- step.addLibPath("/usr/local/opt/icu4c/lib");
- step.addIncludeDir("/usr/local/opt/icu4c/include");
+ step.addLibPath(homebrew_prefix ++ "opt/icu4c/lib");
+ step.addIncludeDir(homebrew_prefix ++ "opt/icu4c/include");
}
for (bindings_files.items) |binding| {
diff --git a/examples/hello-create-react-app/src/App.jsx b/examples/hello-create-react-app/src/App.jsx
new file mode 100644
index 000000000..a675d389d
--- /dev/null
+++ b/examples/hello-create-react-app/src/App.jsx
@@ -0,0 +1,25 @@
+import logo from "./logo.svg";
+import * as React from "react";
+import "./App.css";
+
+function App() {
+ const ms = Date.now() - parseInt(window.location.search.substring(1), 10);
+ return (
+ <div className="App">
+ <header className="App-header">
+ <img src={logo} className="App-logo" alt="logo" />
+ <h3>Loaded in {ms}ms.</h3>
+ <a
+ className="App-link"
+ href="https://reactjs.org"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ Learn React
+ </a>
+ </header>
+ </div>
+ );
+}
+
+export default App;
diff --git a/examples/hello-create-react-app/src/index.jsx b/examples/hello-create-react-app/src/index.jsx
new file mode 100644
index 000000000..26419cdcb
--- /dev/null
+++ b/examples/hello-create-react-app/src/index.jsx
@@ -0,0 +1,17 @@
+import * as React from "react";
+import ReactDOM from "react-dom";
+import "./index.css";
+import App from "./App";
+import reportWebVitals from "./reportWebVitals";
+
+ReactDOM.render(
+ <React.StrictMode>
+ <App />
+ </React.StrictMode>,
+ document.getElementById("root")
+);
+
+// If you want to start measuring performance in your app, pass a function
+// to log results (for example: reportWebVitals(console.log))
+// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
+reportWebVitals();