122122echo " "
123123echo " ==> Setting up nghttp2..."
124124
125- if [ ! -d " nghttp2" ]; then
126- echo " Downloading nghttp2..."
125+ # On macOS, use Homebrew's nghttp2 if available
126+ if [ " $OS " = " Darwin" ] && command -v brew & > /dev/null && brew list libnghttp2 & > /dev/null; then
127+ echo " ✓ Using Homebrew's libnghttp2"
128+ echo " Location: $( brew --prefix libnghttp2) "
129+ else
130+ # Build from source on Linux or if Homebrew version not available
131+ if [ ! -d " nghttp2" ]; then
132+ echo " Downloading nghttp2..."
127133
128- NGHTTP2_VERSION=" 1.59.0"
129- curl -L " https://github.com/nghttp2/nghttp2/releases/download/v${NGHTTP2_VERSION} /nghttp2-${NGHTTP2_VERSION} .tar.gz" \
130- -o nghttp2.tar.gz
134+ NGHTTP2_VERSION=" 1.59.0"
135+ curl -L " https://github.com/nghttp2/nghttp2/releases/download/v${NGHTTP2_VERSION} /nghttp2-${NGHTTP2_VERSION} .tar.gz" \
136+ -o nghttp2.tar.gz
131137
132- tar xzf nghttp2.tar.gz
133- mv " nghttp2-${NGHTTP2_VERSION} " nghttp2
134- rm nghttp2.tar.gz
135- fi
138+ tar xzf nghttp2.tar.gz
139+ mv " nghttp2-${NGHTTP2_VERSION} " nghttp2
140+ rm nghttp2.tar.gz
141+ fi
136142
137- cd nghttp2
143+ cd nghttp2
138144
139- if [ ! -f " lib/.libs/libnghttp2.a" ]; then
140- echo " Building nghttp2..."
145+ if [ ! -f " lib/.libs/libnghttp2.a" ]; then
146+ echo " Building nghttp2..."
141147
142- # Build with -fPIC for use in shared libraries
143- CFLAGS=" -fPIC" ./configure --prefix=" $VENDOR_DIR /nghttp2/install" \
144- --enable-lib-only \
145- --enable-static \
146- --disable-shared \
147- --disable-examples \
148- --disable-python-bindings
148+ # Build with -fPIC for use in shared libraries
149+ CFLAGS=" -fPIC" ./configure --prefix=" $VENDOR_DIR /nghttp2/install" \
150+ --enable-lib-only \
151+ --enable-static \
152+ --disable-shared \
153+ --disable-examples \
154+ --disable-python-bindings
149155
150- make -j$( nproc 2> /dev/null || sysctl -n hw.ncpu 2> /dev/null || echo 4)
151- make install
156+ make -j$( nproc 2> /dev/null || sysctl -n hw.ncpu 2> /dev/null || echo 4)
157+ make install
152158
153- echo " ✓ nghttp2 built successfully"
154- else
155- echo " ✓ nghttp2 already built"
156- fi
159+ echo " ✓ nghttp2 built successfully"
160+ else
161+ echo " ✓ nghttp2 already built"
162+ fi
157163
158- cd " $VENDOR_DIR "
164+ cd " $VENDOR_DIR "
165+ fi
159166
160167#
161168# Summary
@@ -170,7 +177,11 @@ echo " ✓ BoringSSL: $VENDOR_DIR/boringssl/build"
170177if [ " $OS " = " Linux" ]; then
171178 echo " ✓ liburing: $VENDOR_DIR /liburing/install"
172179fi
173- echo " ✓ nghttp2: $VENDOR_DIR /nghttp2/install"
180+ if [ " $OS " = " Darwin" ] && command -v brew & > /dev/null && brew list libnghttp2 & > /dev/null; then
181+ echo " ✓ nghttp2: $( brew --prefix libnghttp2) (Homebrew)"
182+ else
183+ echo " ✓ nghttp2: $VENDOR_DIR /nghttp2/install"
184+ fi
174185echo " "
175186echo " You can now run: make build"
176187echo " "
0 commit comments