1. 21 Nov, 2020 1 commit
  2. 12 Oct, 2020 1 commit
  3. 12 Jul, 2020 1 commit
    • cmake: specify project version · 19eb1e4b
      We currently do not set up a project version within CMake, meaning that
      it can't be use by other projects including libgit2 as a sub-project and
      also not by other tools like IDEs.
      
      This commit changes this to always set up a project version, but instead
      of extracting it from the "version.h" header we now set it up directly.
      This is mostly to avoid mis-use of the previous `LIBGIT2_VERSION`
      variables, as we should now always use the `libgit2_VERSION` ones that
      are set up by CMake if one provides the "VERSION" keyword to the
      `project()` call. While this is one more moving target we need to adjust
      on releases, this commit also adjusts our release script to verify that
      the project version was incremented as expected.
      Patrick Steinhardt committed
  4. 01 Jun, 2020 5 commits
    • cmake: always disable deprecation-sync warnings · 511fb9e6
      We currently disable deprecation synchronization warnings in case we're
      building with Clang. We check for Clang by doing a string comparison on
      the compiler identification, but this seems to have been broken by an
      update in macOS' image as the compiler ID has changed to "AppleClang".
      Let's just unconditionally disable this warning on Unix platforms. We
      never add the deprecated attribute anyway, so the warning doesn't help
      us at all.
      Patrick Steinhardt committed
    • cmake: remove policies · 3956679c
      The `CMAKE_MINIUM_REQUIRE()` function not only sets up the minimum
      required CMake version of a project, but it will also at the same time
      set the CMake policy version. In effect this means that all policies
      that have been introduced before the minimum CMake version will be
      enabled automatically.
      
      When updating our minimum required version ebabb88f (cmake: update
      minimum CMake version to v3.5.1, 2019-10-10), we didn't remove any of
      the policies we've been manually enabling. The newest CMake policy we've
      been enabling is CMP0054, which was introduced back in CMake v3.1. As a
      result, we can now just remove all manual calls to `CMAKE_POLICY()`.
      Patrick Steinhardt committed
    • cmake: remove option to add profiling flags · 2e7d4579
      We currently have an option that adds options for profiling to both our
      CFLAGS and LDFLAGS. Having such flags behind various build options is
      not really sensible at all, since users should instead set up those
      flags via environment variables supported by CMake itself.
      
      Let's remove this option.
      Patrick Steinhardt committed
    • cmake: remove support for creating tags · 2551b1b0
      We currently have support for generating tags via ctags as part of our
      build system. We aren't really in the place of supporting any tooling
      that exists apart from the actual build environment, as doing so adds
      additional complexity and maintenance burden to our build instructions.
      This is in fact nicely demonstrated by this particular option, as it
      hasn't been working anymore since commit e5c9723d (cmake: move library
      build instructions into subdirectory, 2017-06-30).
      
      As a result, this commit removes support for building CTags
      Patrick Steinhardt committed
    • cmake: move modules into the "cmake/" top level dir · bc02bcd9
      Our custom CMake module currently live in "cmake/Modules". As the
      "cmake/" directory doesn't contain anything except the "Modules"
      directory, it doesn't really make sense to have the additional
      intermediate directory. So let's instead move the modules one level up
      into the "cmake/" top level directory.
      Patrick Steinhardt committed
  5. 25 Apr, 2020 1 commit
  6. 14 Mar, 2020 1 commit
    • cmake: use install directories provided via GNUInstallDirs · 87fc539f
      We currently hand-code logic to configure where to install our artifacts
      via the `LIB_INSTALL_DIR`, `INCLUDE_INSTALL_DIR` and `BIN_INSTALL_DIR`
      variables. This is reinventing the wheel, as CMake already provide a way
      to do that via `CMAKE_INSTALL_<DIR>` paths, e.g. `CMAKE_INSTALL_LIB`.
      This requires users of libgit2 to know about the discrepancy and will
      require special hacks for any build systems that handle these variables
      in an automated way. One such example is Gentoo Linux, which sets up
      these paths in both the cmake and cmake-utils eclass.
      
      So let's stop doing that: the GNUInstallDirs module handles it in a
      better way for us, especially so as the actual values are dependent on
      CMAKE_INSTALL_PREFIX. This commit removes our own set of variables and
      instead refers users to use the standard ones.
      
      As a second benefit, this commit also fixes our pkgconfig generation to
      use the GNUInstallDirs module. We had a bug there where we ignored the
      CMAKE_INSTALL_PREFIX when configuring the libdir and includedir keys, so
      if libdir was set to "lib64", then libdir would be an invalid path. With
      GNUInstallDirs, we can now use `CMAKE_INSTALL_FULL_LIBDIR`, which
      handles the prefix for us.
      Patrick Steinhardt committed
  7. 19 Feb, 2020 1 commit
  8. 11 Feb, 2020 1 commit
    • cmake: consolidate Valgrind option · 877054f3
      OpenSSL doesn't initialize bytes on purpose in order to generate
      additional entropy. Valgrind isn't too happy about that though, causing
      it to generate warninings about various issues regarding use of
      uninitialized bytes.
      
      We traditionally had some infrastructure to silence these errors in our
      OpenSSL stream implementation, where we invoke the Valgrind macro
      `VALGRIND_MAKE_MEMDEFINED` in various callbacks that we provide to
      OpenSSL. Naturally, we only include these instructions if a preprocessor
      define "VALGRIND" is set, and that in turn is only set if passing
      "-DVALGRIND" to CMake. We do that in our usual Azure pipelines, but we
      in fact forgot to do this in our nightly build. As a result, we get a
      slew of warnings for these nightly builds, but not for our normal
      builds.
      
      To fix this, we could just add "-DVALGRIND" to our nightly builds. But
      starting with commit d827b11b (tests: execute leak checker via CTest
      directly, 2019-06-28), we do have a secondary variable that directs
      whether we want to use memory sanitizers for our builds. As such, every
      user wishing to use Valgrind for our tests needs to pass both options
      "VALGRIND" and "USE_LEAK_CHECKER", which is cumbersome and error prone,
      as can be seen by our own builds.
      
      Instead, let's consolidate this into a single option, removing the old
      "-DVALGRIND" one. Instead, let's just add the preprocessor directive if
      USE_LEAK_CHECKER equals "valgrind" and remove "-DVALGRIND" from our own
      pipelines.
      Patrick Steinhardt committed
  9. 27 Nov, 2019 1 commit
    • trace: enable tracing by default · 625a3a49
      Tracing is meant to be extremely low-impact when not enabled.  We
      currently ship no tracing calls in libgit2, but if / when we do, the
      tracing infrastructure is created to skip tracing as quickly as
      possible.  It should compile to a simple test when tracing is off.
      
      Thus, there's on reason to not enable it by default.
      Edward Thomson committed
  10. 10 Oct, 2019 1 commit
    • cmake: update minimum CMake version to v3.5.1 · ebabb88f
      Back in commit cf9f3452 (cmake: bump minimum version to 2.8.11,
      2017-09-06), we have bumped the minimum CMake version to require at
      least v2.8.11. The main hold-backs back then were distributions like
      RHEL/CentOS as well as Ubuntu Trusty, which caused us to not target a
      more modern version. Nowadays, Ubuntu Trusty has been EOL'd and CentOS 6
      has CMake v3.6.1 available via the EPEL6 repository, and thus it seems
      fair to upgrade to a more recent version.
      
      Going through repology [1], one can see that all supported mainstream
      distributions do in fact have CMake 3 available. Going through the list,
      the minimum version that is supported by all mainstream distros is in
      fact v3.5.1:
      
      	- CentOS 6 via EPEL6: 3.6.1
      	- Debian Oldstable: 3.7.2
      	- Fedora 26: 3.8.2
      	- OpenMandriva 3.x: 3.5.1
      	- Slackware 14.2: 3.5.2
      	- Ubuntu 16.04: 3.5.1
      
      Consequentally, let's upgrade CMake to the minimum version of 3.5.1 and
      remove all the version CMake checks that aren't required anymore.
      
      [1]: https://repology.org/project/cmake/versions
      Patrick Steinhardt committed
  11. 17 Aug, 2019 1 commit
  12. 20 Jul, 2019 1 commit
    • tests: execute leak checker via CTest directly · d827b11b
      Right now, we have an awful hack in our test CI setup that extracts the
      test command from CTest's output and then prepends the leak checker.
      This is dependent on non-machine-parseable output from CMake and also
      breaks on various ocassions, like for example when we have spaces in the
      current path or when the path contains backslashes. Both conditions may
      easily be triggered on Win32 systems, and in fact they do break our
      Azure Pipelines builds.
      
      Remove the awful hack in favour of a new CMake build option
      "USE_LEAK_CHECKER". If specifying e.g. "-DUSE_LEAK_CHECKER=valgrind",
      then we will set up all tests to be run under valgrind. Like this, we
      can again simply execute ctest without needing to rely on evil sourcery.
      Patrick Steinhardt committed
  13. 24 Jun, 2019 2 commits
    • clang: disable documentation-deprecated-sync · e61b92e0
      Add the `-Wno-documentation-deprecated-sync` switch when compiling with
      clang, since our documentation adds `deprecated` markers, but we do not
      add the deprecation attribute in the code itself.  (ie, the code is out
      of sync with the docs).
      
      In fact, we do not _want_ to mark these items as deprecated in the code,
      at least not yet, as we are not quite ready to bother our end-users with
      this since they're not going away.
      Edward Thomson committed
    • mingw: disable format specification warnings · 54a60ced
      MinGW uses gcc, which expects POSIX formatting for printf, but uses the
      Windows C library, which uses its own format specifiers.  Therefore, it
      gets confused about format specifiers.  Disable warnings for format
      specifiers.
      Edward Thomson committed
  14. 17 Jun, 2019 1 commit
    • cmake: default NTLM client to off if no HTTPS support · 393fb8a1
      If building libgit2 with `-DUSE_HTTPS=NO`, then CMake will
      generate an error complaining that there's no usable HTTPS
      backend for NTLM. In fact, it doesn't make sense to support NTLM
      when we don't support HTTPS. So let's should just have
      NTLM default to OFF when HTTPS is disabled to make life easier
      and to fix our OSSFuzz builds failing.
      Patrick Steinhardt committed
  15. 14 Jun, 2019 1 commit
    • cmake: Modulize our TLS & hash detection · 94fc83b6
      The interactions between `USE_HTTPS` and `SHA1_BACKEND` have been
      streamlined. Previously we would have accepted not quite working
      configurations (like, `-DUSE_HTTPS=OFF -DSHA1_BACKEND=OpenSSL`) and, as
      the OpenSSL detection only ran with `USE_HTTPS`, the link would fail.
      
      The detection was moved to a new `USE_SHA1`, modeled after `USE_HTTPS`,
      which takes the values "CollisionDetection/Backend/Generic", to better
      match how the "hashing backend" is selected, the default (ON) being
      "CollisionDetection".
      
      Note that, as `SHA1_BACKEND` is still used internally, you might need to
      check what customization you're using it for.
      Etienne Samson committed
  16. 13 Jun, 2019 1 commit
    • http-parser: use our bundled http-parser by default · fb529a01
      Our bundled http-parser includes bugfixes, therefore we should prefer
      our http-parser until such time as we can identify that the system
      http-parser has these bugfixes (using a version check).
      
      Since these bugs are - at present - minor, retain the ability for users
      to force that they want to use the system http-parser anyway.  This does
      change the cmake specification so that people _must_ opt-in to the new
      behavior knowingly.
      Edward Thomson committed
  17. 10 Jun, 2019 1 commit
  18. 21 May, 2019 1 commit
  19. 19 May, 2019 2 commits
    • regex: optionally use PCRE2 · ce6d624a
      Use PCRE2 and its POSIX compatibility layer if requested by the user.
      Although PCRE2 is adequate for our needs, the PCRE2 POSIX layer as
      installed on Debian and Ubuntu systems is broken, so we do not opt-in to
      it by default to avoid breaking users on those platforms.
      Edward Thomson committed
    • regex: allow regex selection in cmake · c6e48fef
      Users can now select which regex implementation they want to use: one of
      the system `regcomp_l`, the system PCRE, the builtin PCRE or the
      system's `regcomp`.
      
      By default the system `regcomp_l` will be used if it exists, otherwise
      the system PCRE will be used.  If neither of those exist, then the
      builtin PCRE implementation will be used.
      
      The system's `regcomp` is not used by default due to problems with
      locales.
      Edward Thomson committed
  20. 14 Feb, 2019 2 commits
    • deprecation: optionally enable hard deprecation · dcf81cdb
      Add a CMake option to enable hard deprecation; the resultant library
      will _not_ include any deprecated functions.  This may be useful for
      internal CI builds that create libraries that are not shared with
      end-users to ensure that we do not use deprecated bits internally.
      Edward Thomson committed
    • deprecation: ensure we GIT_EXTERN deprecated funcs · 24ac9e0c
      Although the error functions were deprecated, we did not properly mark
      them as deprecated.  We need to include the `deprecated.h` file in order
      to ensure that the functions get their export attributes.
      
      Similarly, do not define `GIT_DEPRECATE_HARD` within the library, or
      those functions will also not get their export attributes.  Define that
      only on the tests and examples.
      Edward Thomson committed
  21. 25 Jan, 2019 2 commits
  22. 17 Jan, 2019 2 commits
    • cmake: error when STDCALL is specified · 57b753a0
      To explicitly break end-users who were specifying STDCALL, explicitly
      fail the cmake process to ensure that they know that they need to change
      their bindings.  Otherwise, we would quietly ignore their option and the
      resulting cdecl library would produced undefined behavior.
      Edward Thomson committed
    • Use cdecl calling conventions on Win32 · a74dd39b
      The recommendation from engineers within Microsoft is that libraries
      should have a calling convention specified in the public API, and that
      calling convention should be cdecl unless there are strong reasons to
      use a different calling convention.
      
      We previously offered end-users the choice between cdecl and stdcall
      calling conventions.  We did this for presumed wider compatibility: most
      Windows applications will use cdecl, but C# and PInvoke default to
      stdcall for WINAPI compatibility.  (On Windows, the standard library
      functions are are stdcall so PInvoke also defaults to stdcall.)
      
      However, C# and PInvoke can easily call cdecl APIs by specifying an
      annotation.
      
      Thus, we will explicitly declare ourselves cdecl and remove the option
      to build as stdcall.
      Edward Thomson committed
  23. 10 Jan, 2019 1 commit
    • cmake: remove unconditional -Wno-deprecated-declaration on APPLE · 2cc66dd5
      After taking into consideration the following, I think this should be
      removed :
      
      - OpenSSL isn't the default on Apple platforms
      - you have to jump through hoops to get CMake to use OpenSSL on macOS
      (headers aren't in `/usr/include`, so you have to provide `-DOPENSSL_*`
      overrides)
      - users are likely (as getting anywhere near the installed 0.9.8 version
      is insanity IMHO) to package a "modern" version, which wouldn't be
      marked as deprecated
      Etienne Samson committed
  24. 28 Nov, 2018 4 commits
    • CMake: disable deprecated documentation sync · 3a2e4836
      The `-Wdocumentation-deprecated-sync` option will warn when there is a
      doxygen `\deprecated` tag but there is no corresponding deprecation
      attribute on the function.  We want to encourage users to not use
      particular APIs by marking them deprecated in the documentation without
      necessarily raising a compiler warning by marking an item as deprecated.
      Edward Thomson committed
    • http: remove cURL · 21142c5a
      We previously used cURL to support HTTP proxies.  Now that we've added
      this support natively, we can remove the curl dependency.
      Edward Thomson committed
    • cmake: enable warnings for unused const variables · ffe39bab
      Together with the warnings for unused warnings, we always had warnings
      for unused constant variables disabled since commit 823c0e9c (Fix
      broken logic for attr cache invalidation, 2014-04-17). As we have now
      fixed all occurrences of such variables, we can safely enable those
      warnings again.
      Patrick Steinhardt committed
    • cmake: enable warnings for unused functions · 681c58cf
      Ever since commit 823c0e9c (Fix broken logic for attr cache invalidation,
      2014-04-17), we have completely disabled warnings for unused functions. The only
      comment that was added back then is about "annoying extra warnings" from Clang,
      but in fact we shouldn't just ignore warnings about functions which aren't used
      at all. Instead, the right thing would be to either only conditionally compile
      functions that aren't used in all configurations or, alternatively, to remove
      functions that aren't required at all.
      
      As remaining instances of unused functions have been removed in the last two
      commits, re-enable the warning.
      Patrick Steinhardt committed
  25. 17 Oct, 2018 1 commit
  26. 05 Oct, 2018 1 commit
    • cmake: explicitly enable int-conversion warnings · aa0ae59a
      While GCC enables int-conversion warnings by default, it will currently
      only warn about such errors even in case where "-DENABLE_WERROR=ON" has
      been passed to CMake. Explicitly enable int-conversion warnings by using
      our `ENABLE_WARNINGS` macro, which will automatically use
      "-Werror=int-conversions" in case it has been requested by the user.
      Patrick Steinhardt committed
  27. 04 Oct, 2018 2 commits
    • cmake: enable new quoted argument policy CMP0054 · 633584b5
      Quoting from CMP0054's documentation:
      
          Only interpret if() arguments as variables or keywords when
          unquoted.
      
          CMake 3.1 and above no longer implicitly dereference variables or
          interpret keywords in an if() command argument when it is a Quoted
          Argument or a Bracket Argument.
      
          The OLD behavior for this policy is to dereference variables and
          interpret keywords even if they are quoted or bracketed. The NEW
          behavior is to not dereference variables or interpret keywords that
          have been quoted or bracketed.
      
      The previous behaviour could be quite unexpected. Quoted arguments might
      be expanded in case where the value of the argument corresponds to a
      variable. E.g. `IF("MONKEY" STREQUAL "MONKEY")` would have been expanded
      to `IF("1" STREQUAL "1")` iff `SET(MONKEY 1)` was set. This behaviour
      was weird, and recent CMake versions have started to complain about this
      if they see ambiguous situations. Thus we want to disable it in favor of
      the new behaviour.
      Patrick Steinhardt committed
    • cmake: remove spaces between `IF` and `(` for policies · 04d3853f
      Our CMake coding style dictates that there should be no space between
      `IF` and its opening `(`. Adjust our policy statements to honor this
      style.
      Patrick Steinhardt committed