Skip to content

Commit fa44eb3

Browse files
OPEN-00: Add dynamic license header while ossl.rs is generated (#17)
Add dynamic license header while ossl.rs is generated
1 parent ecf0cbd commit fa44eb3

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

core-modules/crypto-openssl-sys/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ build = "builder/main.rs"
2929
bindgen = "0.72.0"
3030
num_cpus = "1.17.0"
3131
cc = "1.2.38"
32+
chrono = { version = "0.4", features = ["clock"] }

core-modules/crypto-openssl-sys/builder/main.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,42 @@
1919
// For additional notes and disclaimer from gematik and in case of changes by gematik,
2020
// find details in the "Readme" file.
2121

22+
use chrono::Datelike;
2223
use std::{
2324
env, fs,
2425
path::{Path, PathBuf},
2526
process::Command,
2627
};
2728

29+
fn get_license_header() -> String {
30+
let year = chrono::Utc::now().year();
31+
format!(
32+
r#"
33+
// SPDX-FileCopyrightText: Copyright {year} gematik GmbH
34+
//
35+
// SPDX-License-Identifier: Apache-2.0
36+
//
37+
// Licensed under the Apache License, Version 2.0 (the "License");
38+
// you may not use this file except in compliance with the License.
39+
// You may obtain a copy of the License at
40+
//
41+
// http://www.apache.org/licenses/LICENSE-2.0
42+
//
43+
// Unless required by applicable law or agreed to in writing, software
44+
// distributed under the License is distributed on an "AS IS" BASIS,
45+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
46+
// See the License for the specific language governing permissions and
47+
// limitations under the License.
48+
//
49+
// *******
50+
//
51+
// For additional notes and disclaimer from gematik and in case of changes by gematik,
52+
// find details in the "Readme" file."#
53+
)
54+
.trim()
55+
.to_string()
56+
}
57+
2858
fn current_dir() -> PathBuf {
2959
env::current_dir().unwrap()
3060
}
@@ -147,6 +177,7 @@ fn build_openssl_bindings() {
147177
.size_t_is_usize(true)
148178
.layout_tests(true)
149179
.prepend_enum_name(true)
180+
.raw_line(get_license_header())
150181
.formatter(bindgen::Formatter::Rustfmt)
151182
.header(wrapper_header.display().to_string())
152183
.clang_args(clang_args)

core-modules/crypto-openssl-sys/src/ossl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* automatically generated by rust-bindgen 0.72.0 */
2+
13
// SPDX-FileCopyrightText: Copyright 2025 gematik GmbH
24
//
35
// SPDX-License-Identifier: Apache-2.0
@@ -19,8 +21,6 @@
1921
// For additional notes and disclaimer from gematik and in case of changes by gematik,
2022
// find details in the "Readme" file.
2123

22-
/* automatically generated by rust-bindgen 0.72.0 */
23-
2424
pub const OPENSSL_SYS_MACOSX: i32 = 1;
2525
pub const OPENSSL_CONFIGURED_API: i32 = 30500;
2626
pub const OPENSSL_VERSION_MAJOR: i32 = 3;

0 commit comments

Comments
 (0)