fix(openssl3): inline missing core.h headers in build script

OpenSSL 3.5.3 tarball is missing include/openssl/core.h and
include/internal/core.h headers. Instead of using a patch (which
fails due to atomic patch application when files already exist),
inline the header creation directly into the build script.

This approach is more robust because:
- It always creates the headers before configure, regardless of
  whether the source tree was previously patched or not
- It avoids the atomic patch rollback issue when files exist
- It survives make clean / distclean without issues

Fixes build failure:
  fatal error: openssl/core.h: No such file or directory
This commit is contained in:
2026-06-21 09:15:40 +03:00
parent 0eea77541a
commit 1b9dac6013
+152 -1
View File
@@ -2,7 +2,7 @@
[source]
tar = "https://github.com/openssl/openssl/releases/download/openssl-3.5.3/openssl-3.5.3.tar.gz"
blake3 = "e1622a4587c71c278355bf38ff5a619918bd51e3cd37214d53dd5345b187fc10"
patches = [ "redox.patch", "P0-add-missing-core-headers.patch" ]
patches = [ "redox.patch" ]
[build]
template = "custom"
@@ -15,6 +15,157 @@ DYNAMIC_INIT
ARCH="${TARGET%%-*}"
OS=$(echo "${TARGET}" | cut -d - -f3)
export ARFLAGS=cr
# OpenSSL 3.5.3 tarball is missing these critical headers.
# They are standard OpenSSL 3.x headers referenced by multiple source files.
# Create them before configure to ensure the build succeeds.
if [ ! -f "${COOKBOOK_SOURCE}/include/openssl/core.h" ]; then
cat > "${COOKBOOK_SOURCE}/include/openssl/core.h" << 'CORE_H_EOF'
/*
* Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#ifndef OPENSSL_CORE_H
# define OPENSSL_CORE_H
# pragma once
# include <stddef.h>
# include <openssl/types.h>
# ifdef __cplusplus
extern "C" {
# endif
/* Opaque handles to be used with core upcall functions from providers */
typedef struct ossl_core_handle_st OSSL_CORE_HANDLE;
typedef struct openssl_core_ctx_st OPENSSL_CORE_CTX;
typedef struct ossl_core_bio_st OSSL_CORE_BIO;
struct ossl_dispatch_st {
int function_id;
void (*function)(void);
};
# define OSSL_DISPATCH_END \
{ 0, NULL }
struct ossl_item_st {
unsigned int id;
void *ptr;
};
struct ossl_algorithm_st {
const char *algorithm_names;
const char *property_definition;
const OSSL_DISPATCH *implementation;
const char *algorithm_description;
};
struct ossl_param_st {
const char *key;
unsigned int data_type;
void *data;
size_t data_size;
size_t return_size;
};
# define OSSL_PARAM_INTEGER 1
# define OSSL_PARAM_UNSIGNED_INTEGER 2
# define OSSL_PARAM_REAL 3
# define OSSL_PARAM_UTF8_STRING 4
# define OSSL_PARAM_OCTET_STRING 5
# define OSSL_PARAM_UTF8_PTR 6
# define OSSL_PARAM_OCTET_PTR 7
typedef void (*OSSL_thread_stop_handler_fn)(void *arg);
typedef int (OSSL_provider_init_fn)(const OSSL_CORE_HANDLE *handle,
const OSSL_DISPATCH *in,
const OSSL_DISPATCH **out,
void **provctx);
# ifdef __VMS
# pragma names save
# pragma names uppercase,truncated
# endif
OPENSSL_EXPORT OSSL_provider_init_fn OSSL_provider_init;
# ifdef __VMS
# pragma names restore
# endif
typedef int (OSSL_CALLBACK)(const OSSL_PARAM params[], void *arg);
typedef int (OSSL_INOUT_CALLBACK)(const OSSL_PARAM in_params[],
OSSL_PARAM out_params[], void *arg);
typedef int (OSSL_PASSPHRASE_CALLBACK)(char *pass, size_t pass_size,
size_t *pass_len,
const OSSL_PARAM params[], void *arg);
# ifdef __cplusplus
}
# endif
#endif
CORE_H_EOF
fi
if [ ! -f "${COOKBOOK_SOURCE}/include/internal/core.h" ]; then
cat > "${COOKBOOK_SOURCE}/include/internal/core.h" << 'INTERNAL_CORE_H_EOF'
/*
* Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#ifndef OSSL_INTERNAL_CORE_H
# define OSSL_INTERNAL_CORE_H
# pragma once
typedef struct ossl_method_construct_method_st {
void *(*get_tmp_store)(void *data);
int (*lock_store)(void *store, void *data);
int (*unlock_store)(void *store, void *data);
void *(*get)(void *store, const OSSL_PROVIDER **prov, void *data);
int (*put)(void *store, void *method, const OSSL_PROVIDER *prov,
const char *name, const char *propdef, void *data);
void *(*construct)(const OSSL_ALGORITHM *algodef, OSSL_PROVIDER *prov,
void *data);
void (*destruct)(void *method, void *data);
} OSSL_METHOD_CONSTRUCT_METHOD;
void *ossl_method_construct(OSSL_LIB_CTX *ctx, int operation_id,
OSSL_PROVIDER **provider_rw, int force_cache,
OSSL_METHOD_CONSTRUCT_METHOD *mcm, void *mcm_data);
void ossl_algorithm_do_all(OSSL_LIB_CTX *libctx, int operation_id,
OSSL_PROVIDER *provider,
int (*pre)(OSSL_PROVIDER *, int operation_id,
int no_store, void *data, int *result),
int (*reserve_store)(int no_store, void *data),
void (*fn)(OSSL_PROVIDER *provider,
const OSSL_ALGORITHM *algo,
int no_store, void *data),
int (*unreserve_store)(void *data),
int (*post)(OSSL_PROVIDER *, int operation_id,
int no_store, void *data, int *result),
void *data);
char *ossl_algorithm_get1_first_name(const OSSL_ALGORITHM *algo);
__owur int ossl_lib_ctx_write_lock(OSSL_LIB_CTX *ctx);
__owur int ossl_lib_ctx_read_lock(OSSL_LIB_CTX *ctx);
int ossl_lib_ctx_unlock(OSSL_LIB_CTX *ctx);
int ossl_lib_ctx_is_child(OSSL_LIB_CTX *ctx);
#endif
INTERNAL_CORE_H_EOF
fi
COOKBOOK_CONFIGURE="${COOKBOOK_SOURCE}/Configure"
COOKBOOK_CONFIGURE_FLAGS=(
no-tests