distributable:
  url: https://github.com/facebook/fbthrift/archive/{{version.tag}}.tar.gz
  strip-components: 1
versions:
  github: facebook/fbthrift/tags
  ignore: [v0.x.y, 0.x.y] # they moved _to_ calver
dependencies:
  # these need to version match, but we don't have a method for that
  github.com/facebookincubator/fizz: '*'
  facebook.com/folly: '*'
  facebook.com/wangle: '*'
  # v9 has clang/gcc mangled export differences O_O
  # https://github.com/llvm/llvm-project/issues/62765#issuecomment-2118040421
  fmt.dev: ^10
  gflags.github.io: ^2.2.2
  google.com/glog: ^0.6
  openssl.org: ^1.1
  boost.org: ^1.83
  facebook.com/zstd: ^1.5.5
  zlib.net: ^1.3
  libsodium.org: ^1.0.19
  linux:
    gnu.org/gcc: 13 # libstdc++
build:
  dependencies:
    cmake.org: '*'
    facebook.com/mvfst: '*'
    gnu.org/bison: '*'
    github.com/westes/flex: '*'
    linux:
      gnu.org/binutils: '*'
  script:
    # llvm's `as` likes to be first, wrongly
    - run: export PATH={{deps.gnu.org/binutils.prefix}}/bin:$PATH
      if: linux
    - cmake -S . -B build/shared $CMAKE_ARGS
    - cmake --build build/shared
    - cmake --install build/shared
  env:
    CMAKE_ARGS:
      - -DCMAKE_INSTALL_PREFIX="{{prefix}}
      - -DCMAKE_INSTALL_LIBDIR=lib
      - -DCMAKE_BUILD_TYPE=Release
      - -DCMAKE_FIND_FRAMEWORK=LAST
      - -DCMAKE_VERBOSE_MAKEFILE=ON
      - -Wno-dev
      - -DBUILD_TESTING=OFF
      # breaks the build
      - -DBUILD_SHARED_LIBS=OFF
    linux:
      CC: gcc
      CXX: g++
      LD: gcc
      CMAKE_ARGS:
        - -DCMAKE_C_FLAGS=-fPIC
        - -DCMAKE_CXX_FLAGS=-fPIC
        - -DCMAKE_EXE_LINKER_FLAGS=-pie
provides:
  - bin/thrift1
test:
  script:
    - thrift1 --gen mstch_cpp2 example.thrift
    - ls | grep gen-cpp2
