From 40c60e656fd5e0aa42d6766462a9b52ac6a4215d Mon Sep 17 00:00:00 2001 From: TheTank20 Date: Fri, 16 Jun 2023 07:57:56 -0500 Subject: [PATCH] Add GitHub Actions CI/CD (#23) * Create linux.yml * Create windows.yml * re-enable static builds make a better linux github workflow * better windows action script fix linux output zip * fix path typos * Update readme --------- Co-authored-by: Neo <321592+Neo-Desktop@users.noreply.github.com> --- .github/workflows/linux.yml | 33 ++++++++++++++++++++++++++++++++ .github/workflows/windows.yml | 36 +++++++++++++++++++++++++++++++++++ CMakeLists.txt | 30 ++++++++++++++++++++++------- README.md | 36 ++++++++++++++++++++++++++++------- 4 files changed, 121 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/linux.yml create mode 100644 .github/workflows/windows.yml diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000..e99388e --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,33 @@ +name: C/C++ CI (Linux) + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout Source Tree + uses: actions/checkout@v3 + + - name: Setup build environment + run: | + sudo apt -y update + sudo apt -y install build-essential cmake libssl-dev + + - name: Build WindowsXPKg + uses: threeal/cmake-action@latest + + - name: Move files to correct directory + run: | + mkdir -p build/actions_upload + mv build/xpkey build/keys.json build/actions_upload/ + + - name: Upload build artifact + uses: actions/upload-artifact@v3.1.2 + with: + name: WindowsXPKg-linux-x86_64-static + path: build/actions_upload diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000..b6b5a53 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,36 @@ +name: C/C++ CI (Windows) + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: windows-latest + + steps: + - name: Checkout Source Tree + uses: actions/checkout@v3 + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1 + + - name: Build WindowsXPKg + run: | + cd build + cmake ../ + msbuild ALL_BUILD.vcxproj /P:Configuration=Release + + - name: Copy files and clean up output directory + run: | + del "build/Release/*.lib" + copy "keys.json" "build/Release/keys.json" + + - name: Upload build artifact + uses: actions/upload-artifact@v3.1.2 + with: + name: WindowsXPKg-Win64 + path: build/Release diff --git a/CMakeLists.txt b/CMakeLists.txt index 596fdb7..bdd5d26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,12 +2,18 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.9) PROJECT(WindowsXPKg) SET(CMAKE_CXX_STANDARD 17) -# TODO: commenting out static builds for now -#SET(OPENSSL_USE_STATIC_LIBS TRUE) +SET(BUILD_SHARED_LIBS OFF) +SET(CMAKE_EXE_LINKER_FLAGS "-static") +SET(OPENSSL_USE_STATIC_LIBS TRUE) +SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + FIND_PACKAGE(OpenSSL REQUIRED) IF(!OPENSSL_FOUND) - MESSAGE(FATAL_ERROR "OpenSSL Development Libraries Not Found") + MESSAGE(SEND_ERROR "OpenSSL Development Libraries Not Found") + MESSAGE(SEND_ERROR "Please consult your package manager of choice to install the prerequisite") + MESSAGE(SEND_ERROR "The package name is commonly called libssl-dev or openssl-dev depending on distribution") + MESSAGE(FATAL_ERROR "Can not continue without OpenSSL") ENDIF() INCLUDE(cmake/CPM.cmake) @@ -23,8 +29,18 @@ CPMAddPackage("gh:fmtlib/fmt#7.1.3") CONFIGURE_FILE(keys.json keys.json COPYONLY) -#SET(BUILD_SHARED_LIBS OFF) -#SET(CMAKE_EXE_LINKER_FLAGS "-static") -ADD_EXECUTABLE(xpkey src/main.cpp src/BINK2002.cpp src/BINK1998.cpp src/key.cpp src/util.cpp src/cli.cpp src/confid.cpp) +ADD_LIBRARY(BINK1998 STATIC src/BINK1998.cpp) +TARGET_INCLUDE_DIRECTORIES(BINK1998 PUBLIC crypto) +TARGET_LINK_LIBRARIES(BINK1998 OpenSSL::Crypto nlohmann_json::nlohmann_json fmt) + +ADD_LIBRARY(BINK2002 STATIC src/BINK2002.cpp) +TARGET_INCLUDE_DIRECTORIES(BINK2002 PUBLIC crypto) +TARGET_LINK_LIBRARIES(BINK2002 OpenSSL::Crypto nlohmann_json::nlohmann_json fmt) + +ADD_LIBRARY(CONFID STATIC src/confid.cpp) +TARGET_INCLUDE_DIRECTORIES(CONFID PUBLIC crypto) +TARGET_LINK_LIBRARIES(CONFID OpenSSL::Crypto nlohmann_json::nlohmann_json fmt) + +ADD_EXECUTABLE(xpkey src/main.cpp src/key.cpp src/util.cpp src/cli.cpp) TARGET_INCLUDE_DIRECTORIES(xpkey PUBLIC crypto) -TARGET_LINK_LIBRARIES(xpkey PUBLIC OpenSSL::Crypto nlohmann_json::nlohmann_json fmt) \ No newline at end of file +TARGET_LINK_LIBRARIES(xpkey BINK1998 BINK2002 CONFID OpenSSL::Crypto nlohmann_json::nlohmann_json fmt) diff --git a/README.md b/README.md index b9646d6..273f1bb 100644 --- a/README.md +++ b/README.md @@ -29,15 +29,27 @@ In light of the recent exponential interest in this project I've decided to put ### **Usage** -1. Feel free to use [XPKeygen](https://github.com/Endermanch/XPKeygen) on **Windows** to generate a key, and use such key during installation. +#### 1. Download the latest version of WindowsXPKg - * If on **Linux** please clone and compile this repository using `cd build && cmake ../ && make` and run using `./xpkey` to generate a Volume License Key + * *(GitHub account required)* + * Download the latest experimental version using the Actions tab ([Windows](https://github.com/Neo-Desktop/WindowsXPKg/actions/workflows/windows.yml), [Linux](https://github.com/Neo-Desktop/WindowsXPKg/actions/workflows/linux.yml)). -2. (For retail only): After installation, you will be prompted to activate Windows. Select the *telephone activation* method, then, run `./xpkey -i ` using the installation ID that the activation wizard gave you. -3. Click "**Next**" + * *(GitHub account \*not\* required)* + * Download the latest release for your operating system and architecture from [the releases page](https://github.com/Neo-Desktop/WindowsXPKg/releases) -4. Profit! + + * **Note:** Before continuing, please ensure you have both the `xpkey` program and the `keys.json` datum extracted and in the same directory + +#### 2. Run `xpkey` to generate a key, or add `--help` to see more options. + +#### 3. *(Activation step for `Retail` and `OEM` only)* + * After installation, you will be prompted to activate Windows. + + + * Select the **telephone activation** method, then, run `xpkey -i ` using the `Installation ID` the activation Wizard provides for you + +#### 4. Profit! ------ @@ -53,9 +65,19 @@ The list of people who have helped to bring the XP generation to where it is now * Endermanch * Neo-Desktop * WitherOrNot +* TheTank20 (the list will be updated to add more collaborators) -**REQUIREMENTS:** +------ -* `OpenSSL >0.9.8b` +### **Development Requirements:** + +* `CMake, make, gcc` (`build-essential`) +* `OpenSSL 1.1.1+` (`libssl-dev`) +* `git` + +#### Build Steps: + +1. `git clone` +2. `cd build/ && cmake ../ && make`