From ed8b734fd857b5be6af60bb1de5f2e3d78a9b16b Mon Sep 17 00:00:00 2001 From: Marc Seitz <4049052+mfts@users.noreply.github.com> Date: Tue, 21 Mar 2023 20:44:35 +0100 Subject: [PATCH] +libxcrypt (#785) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Requires -L because the standard library path has precedence on Linux and usually linux has its own lib crypt. I experimented with trying to use the enable-compat-symlinks (that make xcrypt symlinks) but this option only works if you enable “obsolete modes” which leads to believe it is not wise to do it manually either as other build tools will likely make assumptions based on the filenames. --------- Co-authored-by: Max Howell --- .../github.com/besser82/libxcrypt/fixture.c | 20 +++++++++++++ .../github.com/besser82/libxcrypt/package.yml | 30 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 projects/github.com/besser82/libxcrypt/fixture.c create mode 100644 projects/github.com/besser82/libxcrypt/package.yml diff --git a/projects/github.com/besser82/libxcrypt/fixture.c b/projects/github.com/besser82/libxcrypt/fixture.c new file mode 100644 index 00000000..f8208840 --- /dev/null +++ b/projects/github.com/besser82/libxcrypt/fixture.c @@ -0,0 +1,20 @@ +#include +#include +#include +#include +int main() { + char *hash = crypt("abc", "$2b$05$abcdefghijklmnopqrstuu"); + if (errno) { + fprintf(stderr, "Received error: %s", strerror(errno)); + return errno; + } + if (hash == NULL) { + fprintf(stderr, "Hash is NULL"); + return -1; + } + if (strcmp(hash, "$2b$05$abcdefghijklmnopqrstuuRWUgMyyCUnsDr8evYotXg5ZXVF/HhzS")) { + fprintf(stderr, "Unexpected hash output"); + return -1; + } + return 0; +} diff --git a/projects/github.com/besser82/libxcrypt/package.yml b/projects/github.com/besser82/libxcrypt/package.yml new file mode 100644 index 00000000..0af37374 --- /dev/null +++ b/projects/github.com/besser82/libxcrypt/package.yml @@ -0,0 +1,30 @@ +distributable: + url: https://github.com/besser82/libxcrypt/releases/download/v{{version}}/libxcrypt-{{version}}.tar.xz + strip-components: 1 + +versions: + github: besser82/libxcrypt/releases/tags + +build: + dependencies: + tea.xyz/gx/cc: c99 + tea.xyz/gx/make: '*' + freedesktop.org/pkg-config: ~0.29 + perl.org: '*' + script: | + ./configure $ARGS + make --jobs {{ hw.concurrency }} install + env: + ARGS: + - --prefix="{{prefix}}" + - --disable-valgrind + - --disable-failure-tokens + +test: + dependencies: + tea.xyz/gx/cc: c99 + script: | + cc fixture.c -lcrypt -L{{prefix}}/lib + ./a.out + # ^^ we nee to add the -L because system lib paths come first on Linux + # and most linuxes have a (arcaic) libcrypt.so in /lib