This commit is contained in:
parent
ec1293113f
commit
35cb141334
24
CLAUDE.md
24
CLAUDE.md
@ -59,22 +59,17 @@ The CMakeLists.txt enforces static linking through:
|
||||
- `CMAKE_EXE_LINKER_FLAGS` with `-static` flag
|
||||
- `CMAKE_FIND_LIBRARY_SUFFIXES` set to `.a`
|
||||
- `BUILD_SHARED_LIBS` forced to OFF
|
||||
- Custom library paths from the base image
|
||||
- All libraries installed in standard `/usr/local` paths
|
||||
|
||||
Important: Projects must set CMAKE_PREFIX_PATH and explicitly link PostgreSQL libraries:
|
||||
Important: Projects should set CMAKE_PREFIX_PATH and may need to explicitly link PostgreSQL libraries:
|
||||
```cmake
|
||||
# Set paths for libraries before finding Drogon
|
||||
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH}
|
||||
/usr/local/jsoncpp
|
||||
/usr/local/openssl-musl
|
||||
/usr/local/pgsql
|
||||
# ... other library paths
|
||||
)
|
||||
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} /usr/local)
|
||||
|
||||
# Additional PostgreSQL libraries needed for static linking
|
||||
set(POSTGRESQL_EXTRA_LIBS
|
||||
/usr/local/pgsql/lib/libpgcommon.a
|
||||
/usr/local/pgsql/lib/libpgport.a
|
||||
/usr/local/lib/libpgcommon.a
|
||||
/usr/local/lib/libpgport.a
|
||||
)
|
||||
```
|
||||
|
||||
@ -109,12 +104,11 @@ The system ensures complete static linking by:
|
||||
### Database Support
|
||||
|
||||
Applications can use:
|
||||
- PostgreSQL via libpq at `/usr/local/pgsql/`
|
||||
- MySQL via client library at `/usr/local/mysql/`
|
||||
- MariaDB via connector at `/usr/local/mariadb-connector-c/`
|
||||
- SQLite3 at `/usr/local/sqlite3/`
|
||||
- PostgreSQL via libpq
|
||||
- MySQL via MariaDB connector
|
||||
- SQLite3
|
||||
|
||||
All database libraries are statically linked into the final binary.
|
||||
All database libraries are installed in `/usr/local` and are statically linked into the final binary.
|
||||
|
||||
### HTTP Client Utilities
|
||||
|
||||
|
@ -41,20 +41,17 @@ This base image is designed to create statically-linked C++ executables using:
|
||||
10. **Drogon** (latest from git) - C++ web framework
|
||||
|
||||
### Build Characteristics
|
||||
- All libraries installed in `/usr/local/` with specific prefixes
|
||||
- All libraries installed in standard `/usr/local/` location
|
||||
- Position Independent Code (`-fPIC`) enabled for static linking
|
||||
- CMake configured to prefer static libraries (`.a` suffix)
|
||||
- Drogon built with PostgreSQL, MySQL, and SQLite3 support enabled
|
||||
|
||||
### Important Paths
|
||||
- OpenSSL: `/usr/local/openssl-musl/`
|
||||
- PostgreSQL: `/usr/local/pgsql/`
|
||||
- MariaDB Connector: `/usr/local/mariadb-connector-c/`
|
||||
- SQLite3: `/usr/local/sqlite3/`
|
||||
- MySQL: `/usr/local/mysql/`
|
||||
- jsoncpp: `/usr/local/jsoncpp/`
|
||||
- c-ares: `/usr/local/cares/`
|
||||
- cURL: `/usr/local/curl/`
|
||||
### Library Installation
|
||||
All libraries are installed with:
|
||||
- Headers in `/usr/local/include/`
|
||||
- Static libraries in `/usr/local/lib/`
|
||||
- CMake configs in `/usr/local/lib/cmake/`
|
||||
- pkg-config files in `/usr/local/lib/pkgconfig/`
|
||||
|
||||
### Notes for Development
|
||||
- When modifying the Dockerfile, maintain the build order as dependencies are interlinked
|
||||
|
1
build.sh
1
build.sh
@ -11,6 +11,7 @@ rm -rf "${SCRIPT_DIR}/output"
|
||||
mkdir -p "${SCRIPT_DIR}/output"
|
||||
|
||||
docker build \
|
||||
--no-cache \
|
||||
-t "gitea.jde.nz/public/${PROJECT}-build:latest" \
|
||||
-f "${SCRIPT_DIR}/Dockerfile.dropshell-build" \
|
||||
--build-arg PROJECT="${PROJECT}" \
|
||||
|
@ -98,6 +98,29 @@ set(EXTRA_LIBS
|
||||
|
||||
# Set paths for libraries before finding Drogon
|
||||
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} /usr/local)
|
||||
set(OPENSSL_ROOT_DIR /usr/local)
|
||||
set(OPENSSL_USE_STATIC_LIBS TRUE)
|
||||
|
||||
# Find OpenSSL and create the targets that Trantor expects
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
# Ensure the OpenSSL imported targets exist for Trantor
|
||||
if(NOT TARGET OpenSSL::SSL)
|
||||
add_library(OpenSSL::SSL STATIC IMPORTED)
|
||||
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||
IMPORTED_LOCATION "${OPENSSL_SSL_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "OpenSSL::Crypto"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET OpenSSL::Crypto)
|
||||
add_library(OpenSSL::Crypto STATIC IMPORTED)
|
||||
set_target_properties(OpenSSL::Crypto PROPERTIES
|
||||
IMPORTED_LOCATION "${OPENSSL_CRYPTO_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
find_package(Drogon CONFIG REQUIRED)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Drogon::Drogon)
|
||||
|
Loading…
x
Reference in New Issue
Block a user