Skip to content

Commit

Permalink
SEXP library as git submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx authored and ni4 committed Mar 26, 2023
1 parent d1915c1 commit 51e7c47
Show file tree
Hide file tree
Showing 30 changed files with 88 additions and 324 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ task:
LOCAL_BUILDS: /home/rnpuser/local-builds
LOCAL_INSTALLS: /home/rnpuser/local-installs
USE_STATIC_DEPENDENCIES: yes
DOWNLOAD_SEXP: yes
CIRRUS_CLONE_SUBMODULES: true
user_setup_script: |
# workaround 'pkg: repository meta has wrong version 2'
env ASSUME_ALWAYS_YES=yes pkg bootstrap -f
Expand Down
22 changes: 8 additions & 14 deletions .github/workflows/centos-and-fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true

- name: Setup noncacheable dependencies
run: |
Expand Down Expand Up @@ -175,11 +177,17 @@ jobs:
env: ${{ matrix.env }}

steps:
- name: Install prerequisites for prerequisites
if: matrix.env.container == 'centos:7'
run: yum -y install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm

- name: Install prerequisites
run: yum -y install git sudo rpm-build

- name: Checkout
uses: actions/checkout@v3
with:
submodules: true

- name: Setup noncacheable dependencies
run: |
Expand Down Expand Up @@ -253,20 +261,6 @@ jobs:
if: matrix.env.container == 'centos:7'
run: bash -c "echo \"$(cut -f 2- -d ' ' /opt/rh/rh-ruby30/enable)\"">> $GITHUB_ENV

- name: Checkout sexp
uses: actions/checkout@v3
with:
repository: rnpgp/sexp
path: sexp
ref: v0.7.0
# [TODO ] Remove ref when sexp is integrated as submodule

- name: Build and install sexp
run: |
cmake sexp -Bsexp/build -DWITH_SEXP_TESTS=OFF -DWITH_SEXP_CLI=OFF -DCMAKE_INSTALL_PREFIX=/usr
cmake --build sexp/build --config Release
cmake --install sexp/build
- name: Build rnp
run: |
cmake ~/rpmbuild/SOURCES -B ~/rpmbuild/SOURCES/BUILD -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF \
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true

- name: Install Packages (cpp)
if: ${{ matrix.language == 'cpp' }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/coverity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: Setup environment
run: |
. ci/gha/setup-env.inc.sh
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,17 @@ jobs:
printf "\nrnpuser\tALL=(ALL)\tNOPASSWD:\tALL" > /etc/sudoers.d/rnpuser
printf "\nrnpuser\tsoft\tnproc\tunlimited\n" > /etc/security/limits.d/30-rnpuser.conf
# I386: actions/checkout@v3, actions/cache@v3
# give error about OCI container [https://github.com/actions/checkout/issues/334]
# [https://github.com/actions/runner/issues/1011]
- name: Checkout
- name: Checkout on x86_x64
if: env.CPU == 'x86_64'
uses: actions/checkout@v3
with:
submodules: true

- name: Checkout on i386
if: env.CPU == 'i386'
uses: actions/checkout@v1
with:
submodules: true

- name: Install cmake
run: |
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- uses: DoozyX/[email protected]
with:
clangFormatVersion: 11.0.0
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- uses: ludeeus/action-shellcheck@master
with:
scandir: './ci'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: Setup environment
run: |
. ci/gha/setup-env.inc.sh
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- uses: cachix/install-nix-action@v15
with:
nix_path: nixpkgs=channel:nixos-unstable
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: Setup environment
run: |
. ci/gha/setup-env.inc.sh
Expand Down Expand Up @@ -96,6 +97,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: Setup environment
run: |
. ci/gha/setup-env.inc.sh
Expand Down Expand Up @@ -130,6 +132,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: Setup environment
run: |
. ci/gha/setup-env.inc.sh
Expand Down Expand Up @@ -173,6 +176,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: Setup environment
run: |
. ci/gha/setup-env.inc.sh
Expand Down Expand Up @@ -204,12 +208,14 @@ jobs:
with:
fetch-depth: 1
path: rnp
submodules: true
- name: Download latest version.cmake
uses: actions/checkout@v3
with:
repository: rnpgp/cmake-versioning
fetch-depth: 1
path: cmake-versioning
submodules: true
- name: Compare
run: |
set -x
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/windows-msys2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- uses: msys2/setup-msys2@v2
with:
path-type: minimal
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/libsexp"]
path = src/libsexp
url = https://github.com/rnpgp/sexp.git
17 changes: 7 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ option(ENABLE_COVERAGE "Enable code coverage testing.")
option(ENABLE_SANITIZERS "Enable ASan and other sanitizers.")
option(ENABLE_FUZZERS "Enable fuzz targets.")
option(DOWNLOAD_GTEST "Download Googletest" On)
option(DOWNLOAD_SEXP "Use FetchContent to download sexp library" Off)
option(DOWNLOAD_RUBYRNP "Download ruby-rnp and run related tests." On)
# crypto components
function(tristate_feature_auto NAME DESCRIPTION)
Expand Down Expand Up @@ -176,22 +175,19 @@ if (ENABLE_DOC)
include(AdocMan)
endif()


#download and build sexp library
if(DOWNLOAD_SEXP)
message(STATUS "Downloading SEXP library")
include(DownloadSexp)
else(DOWNLOAD_SEXP)
find_package(Sexp)
endif(DOWNLOAD_SEXP)

# everything else is in subdirs
add_subdirectory(src/examples)
if (ENABLE_FUZZERS)
add_subdirectory(src/fuzzing)
add_compile_options(-DFUZZERS_ENABLED=1)
endif()
add_subdirectory(src/common)

set(WITH_SEXP_CLI OFF)
set(WITH_SEXP_TESTS OFF)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME development)
add_subdirectory(src/libsexp EXCLUDE_FROM_ALL)

add_subdirectory(src/lib)
add_subdirectory(src/rnp)
add_subdirectory(src/rnpkeys)
Expand All @@ -212,5 +208,6 @@ if (BUILD_TESTING)
add_subdirectory(src/tests)
endif()


# cpack packaging (RPM etc)
include(cmake/packaging.cmake)
3 changes: 1 addition & 2 deletions ci/env-common.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
: "${BOTAN_INSTALL:=$LOCAL_INSTALLS/botan-install}"
: "${JSONC_INSTALL:=$LOCAL_INSTALLS/jsonc-install}"
: "${GPG_INSTALL:=$LOCAL_INSTALLS/gpg-install}"
: "${SEXP_INSTALL:=$LOCAL_INSTALLS/sexp-install}"
: "${RNP_INSTALL:=$LOCAL_INSTALLS/rnp-install}"
: "${RUBY_RNP_INSTALL:=$LOCAL_INSTALLS/ruby-rnp}"
: "${RUBY_RNP_VERSION:=main}"
: "${CPU:=}"
: "${SUDO:=}"

for var in LOCAL_BUILDS LOCAL_INSTALLS BOTAN_INSTALL JSONC_INSTALL \
GPG_INSTALL SEXP_INSTALL RNP_INSTALL RUBY_RNP_INSTALL \
GPG_INSTALL RNP_INSTALL RUBY_RNP_INSTALL \
RUBY_RNP_VERSION CPU SUDO; do
export "${var?}"
done
Expand Down
2 changes: 0 additions & 2 deletions ci/gha/setup-env.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ LOCAL_INSTALLS="${rnp_local_installs}"
BOTAN_INSTALL="${rnp_local_installs}/botan-install"
JSONC_INSTALL="${rnp_local_installs}/jsonc-install"
GPG_INSTALL="${rnp_local_installs}/gpg-install"
SEXP_INSTALL="${rnp_local_installs}/sexp-install"

# set this explicitly since we don't want to cache the rnp installation
RNP_INSTALL="${GITHUB_WORKSPACE}/rnp-install"
Expand All @@ -43,7 +42,6 @@ for var in \
BOTAN_INSTALL \
JSONC_INSTALL \
GPG_INSTALL \
SEXP_INSTALL \
RNP_INSTALL
do
val="${!var}"
Expand Down
1 change: 0 additions & 1 deletion ci/install_cacheable_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ set -exu
. ci/env.inc.sh

install_static_cacheable_build_dependencies_if_needed "$@"
install_sexp
27 changes: 0 additions & 27 deletions ci/lib/cacheable_install_functions.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,33 +109,6 @@ install_jsonc() {
fi
}

install_sexp() {
local sexp_build=${LOCAL_BUILDS}/sexp
if [[ ! -e "${SEXP_INSTALL}/lib/sexp.a" ]]; then

if [ -d "${sexp_build}" ]; then
rm -rf "${sexp_build}"
fi

mkdir -p "${sexp_build}"
pushd "${sexp_build}"

wget https://github.com/rnpgp/sexp/archive/refs/tags/v"$SEXP_VERSION".tar.gz -O sexp.tar.gz
tar xzf sexp.tar.gz --strip 1

cmake . -Bbuild -DCMAKE_INSTALL_PREFIX="${SEXP_INSTALL}" \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_SEXP_TESTS=OFF \
-DWITH_SEXP_CLI=OFF

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

popd
fi
}


_install_gpg() {
local VERSION_SWITCH=$1
local NPTH_VERSION=$2
Expand Down
4 changes: 2 additions & 2 deletions ci/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ main() {
pushd "${LOCAL_BUILDS}/rnp-build"

cmakeopts=(
-DCMAKE_BUILD_TYPE=Release # RelWithDebInfo -- DebInfo commented out to speed up recurring CI runs.
-DCMAKE_BUILD_TYPE=Release
-DBUILD_SHARED_LIBS=yes
-DCMAKE_INSTALL_PREFIX="${RNP_INSTALL}"
-DCMAKE_PREFIX_PATH="${BOTAN_INSTALL};${JSONC_INSTALL};${GPG_INSTALL};${SEXP_INSTALL}"
-DCMAKE_PREFIX_PATH="${BOTAN_INSTALL};${JSONC_INSTALL};${GPG_INSTALL}"
)
[[ ${SKIP_TESTS} = 1 ]] && cmakeopts+=(-DBUILD_TESTING=OFF)
[[ "${BUILD_MODE}" = "coverage" ]] && cmakeopts+=(-DENABLE_COVERAGE=yes)
Expand Down
1 change: 0 additions & 1 deletion ci/tests/ci-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ DIR0="$( cd "$( dirname "$0" )" && pwd )"
: "${BOTAN_INSTALL:=/usr}"
: "${JSONC_INSTALL:=/usr}"
: "${RNP_INSTALL:=/usr}"
: "${SEXP_INSTALL:=/usr}"

: "${ENABLE_SM2:=}"
: "${ENABLE_IDEA:=}"
Expand Down
1 change: 0 additions & 1 deletion ci/tests/rpm-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ DIR0="$( cd "$( dirname "$0" )" && pwd )"
: "${BOTAN_INSTALL:=$INSTALL_PREFIX}"
: "${JSONC_INSTALL:=$INSTALL_PREFIX}"
: "${RNP_INSTALL:=$INSTALL_PREFIX}"
: "${SEXP_INSTALL:=$INSTALL_PREFIX}"

: "${ENABLE_SM2:=}"
: "${ENABLE_IDEA:=}"
Expand Down
Loading

0 comments on commit 51e7c47

Please sign in to comment.