Skip to content

Commit

Permalink
Merge pull request #5 from RyeMutt/main
Browse files Browse the repository at this point in the history
Update to 1.62.1 and rework to use cmake build
  • Loading branch information
bennettgoble authored Aug 10, 2024
2 parents 0e76a3c + fdc8721 commit caeded2
Show file tree
Hide file tree
Showing 663 changed files with 101 additions and 161,860 deletions.
56 changes: 15 additions & 41 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,27 @@
name: Build
on: [push]
on:
pull_request:
push:
branches: [main]
tags: [v*]
jobs:
build:
strategy:
matrix:
os: [windows-2022, macos-11, ubuntu-22.04]
os: [windows-2022, macos-12, ubuntu-22.04]
addrsize: ["64"]
include:
- os: windows-2022
addrsize: "32"
runs-on: ${{ matrix.os }}
steps:
- name: Install linux dependencies
if: runner.os == 'Linux'
- name: Setup Homebrew Packages
if: ${{ runner.os == 'macOS' }}
shell: bash
run: brew install ninja cunit
- name: Setup Apt Packages
if: ${{ runner.os == 'Linux' }}
shell: bash
run: |
sudo apt-get install \
g++-12 \
clang-14 \
autoconf \
autoconf-archive \
automake \
autotools-dev \
libtool \
pkg-config \
zlib1g-dev \
libcunit1-dev \
libssl-dev \
libxml2-dev \
libev-dev \
libevent-dev \
libjansson-dev \
libjemalloc-dev \
libc-ares-dev \
libelf-dev \
cmake \
cmake-data
- name: Install macOS dependencies
if: runner.os == 'macOS'
run: |
brew install \
autoconf-archive \
libev \
cunit \
libressl \
automake
sudo apt-get update
sudo apt-get -y install ninja-build libcunit1-dev
- uses: secondlife/action-autobuild@v4
with:
addrsize: ${{ matrix.addrsize }}
Expand All @@ -55,5 +31,3 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: secondlife/action-autobuild-release@v3
with:
public: true
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "nghttp2"]
path = nghttp2
url = https://github.com/nghttp2/nghttp2.git
8 changes: 4 additions & 4 deletions autobuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
</map>
<key>manifest</key>
<array>
<string>lib/release/libnghttp2*.dylib</string>
<string>lib/release/libnghttp2*.a</string>
</array>
<key>name</key>
<string>darwin</string>
Expand Down Expand Up @@ -129,9 +129,9 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>source_directory</key>
<string>nghttp2</string>
<key>source_type</key>
<string>hg</string>
<key>version_file</key>
<string>VERSION.txt</string>
<string>git</string>
<key>use_scm_version</key>
<boolean>true</boolean>
</map>
<key>type</key>
<string>autobuild</string>
Expand Down
148 changes: 78 additions & 70 deletions build-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if [ -z "$AUTOBUILD" ] ; then
exit 1
fi

if [ "$OSTYPE" = "cygwin" ] ; then
if [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]] ; then
autobuild="$(cygpath -u $AUTOBUILD)"
else
autobuild="$AUTOBUILD"
Expand All @@ -30,9 +30,6 @@ source_environment_tempfile="$stage/source_environment.sh"
# remove_cxxstd
source "$(dirname "$AUTOBUILD_VARIABLES_FILE")/functions"

NGHTTP2_VERSION_HEADER_DIR="$top/nghttp2/lib/includes/nghttp2"
build=${AUTOBUILD_BUILD_ID:=0}

# Restore all .sos
restore_sos ()
{
Expand All @@ -57,88 +54,99 @@ restore_dylibs ()
pushd "$top/nghttp2"
case "$AUTOBUILD_PLATFORM" in
windows*)

packages="$(cygpath -m "$stage/packages")"
load_vsvars

cmake . -G"$AUTOBUILD_WIN_CMAKE_GEN" -A"$AUTOBUILD_WIN_VSPLATFORM" \
-DCMAKE_C_FLAGS:STRING="$LL_BUILD_RELEASE" \
-DCMAKE_CXX_FLAGS:STRING="$LL_BUILD_RELEASE" \
-DCMAKE_INSTALL_PREFIX="$(cygpath -m "$stage")"

cmake --build . --config Release

# Stage archives
mkdir -p "${stage}/lib/release"
mv "$top/nghttp2/lib/Release"/nghttp2.* "${stage}"/lib/release/
opts="$(replace_switch /Zi /Z7 $LL_BUILD_RELEASE)"
plainopts="$(remove_switch /GR $(remove_cxxstd $opts))"

# Release Build
mkdir -p "build"
pushd "build"
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS="$plainopts" \
-DCMAKE_CXX_FLAGS="$opts" \
-DCMAKE_INSTALL_PREFIX="$(cygpath -m $stage)" \
-DCMAKE_INSTALL_LIBDIR="$(cygpath -m "$stage/lib/release")" \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DENABLE_LIB_ONLY=ON \
-DBUILD_STATIC_LIBS=ON

cmake --build . --config Release --clean-first
cmake --install . --config Release
popd
;;

darwin*)
opts="${TARGET_OPTS:--arch $AUTOBUILD_CONFIGURE_ARCH $LL_BUILD_RELEASE}"
plainopts="$(remove_cxxstd $opts)"

# Release configure and build
autoreconf -i
automake
autoconf
./configure --enable-lib-only CFLAGS="$plainopts" CXXFLAGS="$opts"
make -j$(nproc)
make check

# deploy target
export MACOSX_DEPLOYMENT_TARGET=${LL_BUILD_DARWIN_DEPLOY_TARGET}

for arch in x86_64 arm64 ; do
ARCH_ARGS="-arch $arch"
cxx_opts="${TARGET_OPTS:-$ARCH_ARGS $LL_BUILD_RELEASE}"
cc_opts="$(remove_cxxstd $cxx_opts)"

mkdir -p "build_$arch"
pushd "build_$arch"
cmake .. -G Ninja -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS="$cc_opts" \
-DCMAKE_CXX_FLAGS="$cxx_opts" \
-DCMAKE_INSTALL_PREFIX="$stage" \
-DCMAKE_INSTALL_LIBDIR="$stage/lib/release" \
-DCMAKE_OSX_ARCHITECTURES:STRING=$arch \
-DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} \
-DCMAKE_MACOSX_RPATH=YES \
-DCMAKE_INSTALL_PREFIX="$stage" \
-DCMAKE_INSTALL_LIBDIR="$stage/lib/release/$arch" \
-DENABLE_LIB_ONLY=ON \
-DBUILD_STATIC_LIBS=ON

cmake --build . --config Release
cmake --install . --config Release

# conditionally run unit tests
if [ "${DISABLE_UNIT_TESTS:-0}" = "0" -a "$arch" = "$(uname -m)" ]; then
cmake --build . --config Release -t check
fi
popd
done

# create staging dirs
mkdir -p "$stage/include/nghttp2"
mkdir -p "$stage/lib/release"
# ?! Unclear why this build tucks built libraries into a hidden
# .libs directory.
mv "$top/nghttp2/lib/.libs/"/libnghttp2*.dylib "$stage/lib/release/"

# SL-807: fix_dylib_id doesn't really handle symlinks, even though
# it's coded to try to do so. Chase the multiple levels of
# indirection to find the real dylib.
pushd "$stage/lib/release"
dylib="libnghttp2.dylib"
while [ -L "$dylib" ]
do dylib="$(readlink "$dylib")"
done
fix_dylib_id "$dylib"
popd

# make distclean
# create fat libraries
lipo -create -output ${stage}/lib/release/libnghttp2.a ${stage}/lib/release/x86_64/libnghttp2.a ${stage}/lib/release/arm64/libnghttp2.a
;;

linux*)
# Default target per --address-size
opts="${TARGET_OPTS:--m$AUTOBUILD_ADDRSIZE $LL_BUILD_RELEASE}"
plainopts="$(remove_cxxstd $opts)"

# Handle any deliberate platform targeting
if [ -z "${TARGET_CPPFLAGS:-}" ]; then
# Remove sysroot contamination from build environment
unset CPPFLAGS
else
# Incorporate special pre-processing flags
export CPPFLAGS="$TARGET_CPPFLAGS"
fi

# Release configure and build
autoreconf -i
automake
autoconf
./configure --enable-lib-only CFLAGS="$plainopts" CXXFLAGS="$opts"
make -j$(nproc)
make check

mkdir -p "$stage/lib/release"
# ?! Unclear why this build tucks built libraries into a hidden
# .libs directory.
mv "$top/nghttp2/lib/.libs/libnghttp2.a" "$stage/lib/release/"
mkdir -p "build"
pushd "build"
CFLAGS="$plainopts" \
cmake .. -G Ninja -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING=ON \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_C_FLAGS="$plainopts" \
-DCMAKE_CXX_FLAGS="$opts" \
-DCMAKE_INSTALL_PREFIX="$stage" \
-DCMAKE_INSTALL_LIBDIR="$stage/lib/release" \
-DENABLE_LIB_ONLY=ON \
-DBUILD_STATIC_LIBS=ON

cmake --build . --config Release
cmake --install . --config Release

# conditionally run unit tests
if [ "${DISABLE_UNIT_TESTS:-0}" = "0" ]; then
cmake --build . --config Release -t check
fi
popd
;;
esac
mkdir -p "$stage/LICENSES"
cp "$top/nghttp2/COPYING" "$stage/LICENSES/nghttp2.txt"
popd

# Must be done after the build. nghttp2ver.h is created as part of the build.
version="$(sed -n -E 's/#define NGHTTP2_VERSION "([^"]+)"/\1/p' "${NGHTTP2_VERSION_HEADER_DIR}/nghttp2ver.h" | tr -d '\r' )"
echo "${version}.${build}" > "${stage}/VERSION.txt"

mkdir -p "$stage/include/nghttp2"
cp "$NGHTTP2_VERSION_HEADER_DIR"/*.h "$stage/include/nghttp2/"
1 change: 1 addition & 0 deletions nghttp2
Submodule nghttp2 added at d13a57
Loading

0 comments on commit caeded2

Please sign in to comment.