Skip to content

Commit

Permalink
chore(libsodium): preserve libsodium's license & copyright in the tra…
Browse files Browse the repository at this point in the history
…nslated bindings
  • Loading branch information
BradleyChatha committed Jan 1, 2024
1 parent 0c7a919 commit d3fd6e8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
24 changes: 23 additions & 1 deletion devops/scripts/clean-libsodium-di.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ module clean;
import std : writeln, lineSplitter, readText, Appender, canFind, endsWith, array, substitute;
import std.file : write;

const LIBSODIUM_LICENSE = `
/*
* ISC License
*
* Copyright (c) 2013-2023
* Frank Denis <j at pureftpd dot org>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
`;

void main()
{
const input = readText("sodium.di");
Expand All @@ -13,7 +34,8 @@ void main()
output.reserve(input.length);

output.put("// This file was automatically generated by devops/scripts/gen-libsodium-di.bash\n");
output.put("// libsodium and this file are licensed under the ISC license.\n");
output.put("// The preserved libsodium ISC license is presented below, and extends to this file.\n");
output.put(LIBSODIUM_LICENSE);
output.put("module juptune.crypto.libsodium;\n");
output.put("extern(C) @nogc nothrow:\n");

Expand Down
3 changes: 2 additions & 1 deletion devops/scripts/gen-libsodium-di.bash
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ main() {
clang --version

# Fetch libsodium
if [[ ! -d "${LIBSODIUM_DIR}" ]]; then
if [[ ! -f "${LIBSODIUM_DIR}/.gitignore" ]]; then
git clone https://github.com/jedisct1/libsodium ${LIBSODIUM_DIR}
fi
git checkout tags/${LIBSODIUM_TAG} > /dev/null 2>&1
Expand Down Expand Up @@ -54,4 +54,5 @@ main() {
mv libsodium.di ${JUPTUNE_DIR}/src/juptune/crypto/libsodium.di
}

mkdir -p ${LIBSODIUM_DIR} || true
pushd ${LIBSODIUM_DIR}; main; popd
21 changes: 20 additions & 1 deletion src/juptune/crypto/libsodium.di
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
// This file was automatically generated by devops/scripts/gen-libsodium-di.bash
// libsodium and this file are licensed under the ISC license.
// The preserved libsodium ISC license is presented below, and extends to this file.

/*
* ISC License
*
* Copyright (c) 2013-2023
* Frank Denis <j at pureftpd dot org>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
module juptune.crypto.libsodium;
extern(C) @nogc nothrow:
__gshared const(char)* sodium_version_string();
Expand Down

0 comments on commit d3fd6e8

Please sign in to comment.