Compare commits
3 Commits
v0.1.2.4
...
d712d3a9d8
| Author | SHA1 | Date | |
|---|---|---|---|
| d712d3a9d8 | |||
| 000fde485f | |||
|
|
b97d9f2d7f |
@@ -17,8 +17,16 @@ elseif(UNIX)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Handle dependencies
|
# Handle dependencies
|
||||||
find_package(cryptopp CONFIG REQUIRED)
|
if(WIN32)
|
||||||
find_package(nlohmann_json CONFIG REQUIRED)
|
# Windows: Use vcpkg packages
|
||||||
|
find_package(cryptopp CONFIG REQUIRED)
|
||||||
|
find_package(nlohmann_json CONFIG REQUIRED)
|
||||||
|
else()
|
||||||
|
# Linux: Use system packages
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
pkg_check_modules(CRYPTOPP REQUIRED libcryptopp)
|
||||||
|
pkg_check_modules(NLOHMANN_JSON REQUIRED nlohmann_json)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Add library sources
|
# Add library sources
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
@@ -45,17 +53,34 @@ target_include_directories(privatebinapi PUBLIC
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
)
|
)
|
||||||
|
|
||||||
# Explicitly include vcpkg directories
|
# Platform-specific include directories
|
||||||
target_include_directories(privatebinapi PRIVATE
|
if(WIN32)
|
||||||
|
# Windows: Include vcpkg directories
|
||||||
|
target_include_directories(privatebinapi PRIVATE
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/vcpkg_installed/x64-windows/include
|
${CMAKE_CURRENT_BINARY_DIR}/vcpkg_installed/x64-windows/include
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Link dependencies
|
# Link dependencies
|
||||||
target_link_libraries(privatebinapi PRIVATE
|
if(WIN32)
|
||||||
|
# Windows: Use vcpkg targets
|
||||||
|
target_link_libraries(privatebinapi PRIVATE
|
||||||
cryptopp::cryptopp
|
cryptopp::cryptopp
|
||||||
nlohmann_json::nlohmann_json
|
nlohmann_json::nlohmann_json
|
||||||
${PLATFORM_LIBS}
|
${PLATFORM_LIBS}
|
||||||
)
|
)
|
||||||
|
else()
|
||||||
|
# Linux: Use system libraries
|
||||||
|
target_link_libraries(privatebinapi PRIVATE
|
||||||
|
${CRYPTOPP_LIBRARIES}
|
||||||
|
${NLOHMANN_JSON_LIBRARIES}
|
||||||
|
${PLATFORM_LIBS}
|
||||||
|
)
|
||||||
|
target_include_directories(privatebinapi PRIVATE
|
||||||
|
${CRYPTOPP_INCLUDE_DIRS}
|
||||||
|
${NLOHMANN_JSON_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Install targets
|
# Install targets
|
||||||
install(TARGETS privatebinapi
|
install(TARGETS privatebinapi
|
||||||
|
|||||||
105
README.md
105
README.md
@@ -119,9 +119,11 @@ This script:
|
|||||||
- Configures CMake with proper toolchain
|
- Configures CMake with proper toolchain
|
||||||
- Builds the project using MSVC compiler
|
- Builds the project using MSVC compiler
|
||||||
|
|
||||||
### Linux/macOS Build Script
|
### Linux Build Scripts
|
||||||
|
|
||||||
|
#### Automated Build Script
|
||||||
**File:** `scripts/build.sh`
|
**File:** `scripts/build.sh`
|
||||||
**Requirements:** CMake, C++17 compiler, vcpkg
|
**Requirements:** CMake, C++17 compiler, system packages
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Make executable and run from project root
|
# Make executable and run from project root
|
||||||
@@ -129,6 +131,54 @@ chmod +x scripts/build.sh
|
|||||||
./scripts/build.sh
|
./scripts/build.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This script:
|
||||||
|
- Automatically detects and installs required dependencies
|
||||||
|
- Configures CMake with Unix Makefiles
|
||||||
|
- Builds the project in Release configuration
|
||||||
|
|
||||||
|
#### Manual Linux Build (Recommended)
|
||||||
|
**Requirements:** CMake 3.10+, GCC/Clang with C++17 support, system packages
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install dependencies (Fedora/RHEL/CentOS)
|
||||||
|
sudo dnf install cmake gcc-c++ libcurl-devel cryptopp-devel json-devel
|
||||||
|
|
||||||
|
# Install dependencies (Ubuntu/Debian)
|
||||||
|
sudo apt install cmake g++ libcurl4-openssl-dev libcrypto++-dev nlohmann-json3-dev
|
||||||
|
|
||||||
|
# Build the project
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake ..
|
||||||
|
make -j$(nproc)
|
||||||
|
|
||||||
|
# Run tests
|
||||||
|
ctest --verbose
|
||||||
|
|
||||||
|
# Run example
|
||||||
|
./example/example
|
||||||
|
```
|
||||||
|
|
||||||
|
**Linux Dependencies:**
|
||||||
|
- **libcurl-devel** - HTTP client library
|
||||||
|
- **cryptopp-devel** - Cryptographic library
|
||||||
|
- **json-devel** - JSON parsing library
|
||||||
|
- **cmake** - Build system
|
||||||
|
- **gcc-c++** - C++17 compiler
|
||||||
|
|
||||||
|
### macOS Build Script
|
||||||
|
**File:** `scripts/build.sh`
|
||||||
|
**Requirements:** CMake, C++17 compiler, Homebrew packages
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install dependencies via Homebrew
|
||||||
|
brew install cmake cryptopp nlohmann-json curl
|
||||||
|
|
||||||
|
# Make executable and run from project root
|
||||||
|
chmod +x scripts/build.sh
|
||||||
|
./scripts/build.sh
|
||||||
|
```
|
||||||
|
|
||||||
This script:
|
This script:
|
||||||
- Bootstraps vcpkg if not present
|
- Bootstraps vcpkg if not present
|
||||||
- Configures CMake with Unix Makefiles
|
- Configures CMake with Unix Makefiles
|
||||||
@@ -140,8 +190,9 @@ This script:
|
|||||||
|
|
||||||
- CMake 3.10+
|
- CMake 3.10+
|
||||||
- C++17 compatible compiler
|
- C++17 compatible compiler
|
||||||
- Crypto++ (via vcpkg)
|
- **Windows:** Crypto++ and nlohmann/json (via vcpkg)
|
||||||
- nlohmann/json (via vcpkg)
|
- **Linux:** libcurl, cryptopp, and nlohmann-json (via system packages)
|
||||||
|
- **macOS:** libcurl, cryptopp, and nlohmann/json (via Homebrew)
|
||||||
|
|
||||||
### Compilation
|
### Compilation
|
||||||
|
|
||||||
@@ -157,14 +208,43 @@ powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\build_windows.ps1
|
|||||||
scripts\build_thinkpad.bat
|
scripts\build_thinkpad.bat
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Linux/macOS - Build via scripts/build.sh
|
#### Linux - Automated Build via scripts/build.sh
|
||||||
```bash
|
```bash
|
||||||
# Requires: CMake, C++17 compiler, vcpkg
|
# Requires: CMake, C++17 compiler, system packages
|
||||||
chmod +x scripts/build.sh
|
chmod +x scripts/build.sh
|
||||||
./scripts/build.sh
|
./scripts/build.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Manual Build
|
#### Linux - Manual Build (Recommended)
|
||||||
|
```bash
|
||||||
|
# Install dependencies (Fedora/RHEL/CentOS)
|
||||||
|
sudo dnf install cmake gcc-c++ libcurl-devel cryptopp-devel json-devel
|
||||||
|
|
||||||
|
# Install dependencies (Ubuntu/Debian)
|
||||||
|
sudo apt install cmake g++ libcurl4-openssl-dev libcrypto++-dev nlohmann-json3-dev
|
||||||
|
|
||||||
|
# Build the project
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake ..
|
||||||
|
make -j$(nproc)
|
||||||
|
|
||||||
|
# Run tests and examples
|
||||||
|
ctest --verbose
|
||||||
|
./example/example
|
||||||
|
```
|
||||||
|
|
||||||
|
#### macOS - Build via scripts/build.sh
|
||||||
|
```bash
|
||||||
|
# Install dependencies via Homebrew
|
||||||
|
brew install cmake cryptopp nlohmann-json curl
|
||||||
|
|
||||||
|
# Requires: CMake, C++17 compiler, Homebrew packages
|
||||||
|
chmod +x scripts/build.sh
|
||||||
|
./scripts/build.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Manual Build (All Platforms)
|
||||||
```bash
|
```bash
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
@@ -172,7 +252,9 @@ cmake ..
|
|||||||
cmake --build . --config Release
|
cmake --build . --config Release
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** The manual build method requires you to have all dependencies (CMake, compiler, vcpkg) properly configured. For most users, the platform-specific build scripts are recommended.
|
**Note:** The manual build method requires you to have all dependencies properly configured. For most users, the platform-specific build scripts are recommended.
|
||||||
|
|
||||||
|
**Linux Compatibility:** The project has been tested and successfully builds on Fedora Linux with system packages. It automatically detects the platform and uses appropriate dependency resolution methods (vcpkg for Windows, system packages for Linux/macOS).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -382,6 +464,13 @@ See [LICENSE](LICENSE) for details.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### v0.1.1.6 (2025-08-28)
|
||||||
|
- **NEW**: Full Linux compatibility with system packages
|
||||||
|
- **NEW**: Automatic platform detection (Windows: vcpkg, Linux: system packages)
|
||||||
|
- **IMPROVED**: Enhanced Linux build documentation and instructions
|
||||||
|
- **IMPROVED**: Better dependency management for cross-platform builds
|
||||||
|
- **FIXED**: CMakeLists.txt now works on both Windows and Linux without manual configuration
|
||||||
|
|
||||||
### v0.1.1.5 (2025-08-28)
|
### v0.1.1.5 (2025-08-28)
|
||||||
- **NEW**: Enhanced text format support (plaintext, syntax highlighting, markdown)
|
- **NEW**: Enhanced text format support (plaintext, syntax highlighting, markdown)
|
||||||
- **NEW**: Comprehensive format testing in examples and integration tests
|
- **NEW**: Comprehensive format testing in examples and integration tests
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$false)]
|
[Parameter(Mandatory=$false)]
|
||||||
[string]$Token,
|
[string]$Token
|
||||||
|
|
||||||
[Parameter(Mandatory=$false)]
|
|
||||||
[switch]$Build
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Token aus Umgebungsvariable laden falls nicht als Parameter übergeben
|
# Token aus Umgebungsvariable laden falls nicht als Parameter übergeben
|
||||||
@@ -12,6 +9,7 @@ if (-not $Token) {
|
|||||||
if (-not $Token) {
|
if (-not $Token) {
|
||||||
Write-Host "Fehler: Kein Token angegeben und GITEA_TOKEN Umgebungsvariable nicht gesetzt!" -ForegroundColor Red
|
Write-Host "Fehler: Kein Token angegeben und GITEA_TOKEN Umgebungsvariable nicht gesetzt!" -ForegroundColor Red
|
||||||
Write-Host "Verwendung: .\create_release.ps1 -Token 'your_token' oder setze GITEA_TOKEN Umgebungsvariable" -ForegroundColor Yellow
|
Write-Host "Verwendung: .\create_release.ps1 -Token 'your_token' oder setze GITEA_TOKEN Umgebungsvariable" -ForegroundColor Yellow
|
||||||
|
Write-Host "Das Script führt automatisch einen Build durch und lädt alle Artefakte hoch." -ForegroundColor Cyan
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
Write-Host "Token aus Umgebungsvariable GITEA_TOKEN geladen" -ForegroundColor Green
|
Write-Host "Token aus Umgebungsvariable GITEA_TOKEN geladen" -ForegroundColor Green
|
||||||
@@ -43,21 +41,20 @@ if ($lastTag -match "^v(\d+)\.(\d+)\.(\d+)(.*)$") {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build falls gewünscht
|
# Build durchführen
|
||||||
if ($Build) {
|
Write-Host "Führe Build durch..." -ForegroundColor Yellow
|
||||||
Write-Host "Führe Build durch..." -ForegroundColor Yellow
|
if (Test-Path "scripts\build_thinkpad.bat") {
|
||||||
if (Test-Path "scripts\build_thinkpad.bat") {
|
|
||||||
Write-Host "Verwende scripts\build_thinkpad.bat..." -ForegroundColor Yellow
|
Write-Host "Verwende scripts\build_thinkpad.bat..." -ForegroundColor Yellow
|
||||||
cmd /c scripts\build_thinkpad.bat
|
cmd /c scripts\build_thinkpad.bat
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Verwende scripts\build_windows.ps1..." -ForegroundColor Yellow
|
Write-Host "Verwende scripts\build_windows.ps1..." -ForegroundColor Yellow
|
||||||
powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\build_windows.ps1
|
powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\build_windows.ps1
|
||||||
}
|
}
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
Write-Host "Build fehlgeschlagen!" -ForegroundColor Red
|
Write-Host "Build fehlgeschlagen!" -ForegroundColor Red
|
||||||
exit 1
|
exit 1
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Write-Host "Build erfolgreich abgeschlossen!" -ForegroundColor Green
|
||||||
|
|
||||||
# Änderungen committen
|
# Änderungen committen
|
||||||
$status = git status --porcelain
|
$status = git status --porcelain
|
||||||
@@ -72,7 +69,7 @@ git tag -a $newVersion -m "Release $newVersion"
|
|||||||
git push origin $newVersion
|
git push origin $newVersion
|
||||||
|
|
||||||
# Release erstellen
|
# Release erstellen
|
||||||
$releaseBody = "## What is New in $newVersion`n`n- AUTOMATED: Release created by script`n- VERSION: Bumped from $lastTag to $newVersion`n`n## Build Artifacts`n`n- privatebinapi.dll - Windows Dynamic Link Library`n- privatebinapi.lib - Windows Import Library`n- example.exe - Combined example program`n- privatebinapi.h - C++ header file"
|
$releaseBody = "## What is New in $newVersion`n`n- AUTOMATED: Release created by script`n- VERSION: Bumped from $lastTag to $newVersion`n- BUILD: Automatic build with build_thinkpad.bat`n`n## Build Artifacts`n`nBuild-Artefakte werden automatisch hochgeladen und hier angezeigt.`n`nTypische Artefakte:`n- privatebinapi.dll - Windows Dynamic Link Library`n- privatebinapi.lib - Windows Import Library`n- example.exe - Combined example program`n- privatebinapi.h - C++ header file"
|
||||||
|
|
||||||
$releaseData = @{
|
$releaseData = @{
|
||||||
tag_name = $newVersion
|
tag_name = $newVersion
|
||||||
@@ -93,3 +90,59 @@ $release = Invoke-RestMethod -Uri $releaseUri -Method Post -Headers $headers -Bo
|
|||||||
Write-Host "Release erstellt: $($release.id)" -ForegroundColor Green
|
Write-Host "Release erstellt: $($release.id)" -ForegroundColor Green
|
||||||
Write-Host "URL: $($release.html_url)" -ForegroundColor Green
|
Write-Host "URL: $($release.html_url)" -ForegroundColor Green
|
||||||
|
|
||||||
|
# Build-Artefakte zum Release hinzufügen
|
||||||
|
Write-Host "Füge Build-Artefakte hinzu..." -ForegroundColor Yellow
|
||||||
|
|
||||||
|
# Artefakte aus dem dist-Ordner finden
|
||||||
|
$distPath = "dist"
|
||||||
|
if (Test-Path $distPath) {
|
||||||
|
$artifacts = Get-ChildItem -Path $distPath -Recurse -File | Where-Object {
|
||||||
|
$_.Extension -match "\.(dll|lib|exe|h|zip)$"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($artifacts) {
|
||||||
|
Write-Host "Gefundene Artefakte:" -ForegroundColor Green
|
||||||
|
foreach ($artifact in $artifacts) {
|
||||||
|
Write-Host " - $($artifact.Name)" -ForegroundColor White
|
||||||
|
}
|
||||||
|
|
||||||
|
# Artefakte hochladen
|
||||||
|
foreach ($artifact in $artifacts) {
|
||||||
|
Write-Host "Lade hoch: $($artifact.Name)..." -ForegroundColor Yellow
|
||||||
|
|
||||||
|
$uploadUri = "https://gitea.medisoftware.org/api/v1/repos/Markus/lib-privatebin/releases/$($release.id)/assets"
|
||||||
|
|
||||||
|
$boundary = [System.Guid]::NewGuid().ToString()
|
||||||
|
$LF = "`r`n"
|
||||||
|
$bodyLines = @(
|
||||||
|
"--$boundary",
|
||||||
|
"Content-Disposition: form-data; name=`"attachment`"; filename=`"$($artifact.Name)`"",
|
||||||
|
"Content-Type: application/octet-stream",
|
||||||
|
"",
|
||||||
|
[System.IO.File]::ReadAllBytes($artifact.FullName),
|
||||||
|
"--$boundary--"
|
||||||
|
)
|
||||||
|
|
||||||
|
$body = $bodyLines -join $LF
|
||||||
|
|
||||||
|
$uploadHeaders = @{
|
||||||
|
"Authorization" = "token $Token"
|
||||||
|
"Content-Type" = "multipart/form-data; boundary=$boundary"
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$uploadResponse = Invoke-RestMethod -Uri $uploadUri -Method Post -Headers $uploadHeaders -Body $body
|
||||||
|
Write-Host " ✓ $($artifact.Name) erfolgreich hochgeladen" -ForegroundColor Green
|
||||||
|
} catch {
|
||||||
|
Write-Host " ✗ Fehler beim Hochladen von $($artifact.Name): $($_.Exception.Message)" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Host "Keine Build-Artefakte im dist-Ordner gefunden!" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Host "dist-Ordner nicht gefunden!" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Release-Erstellung abgeschlossen!" -ForegroundColor Green
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user