Skip to content

Commit

Permalink
Generate 64 bit ubuntu 22.04 deb package
Browse files Browse the repository at this point in the history
  • Loading branch information
klei1984 committed May 16, 2024
1 parent a3f01c8 commit 25dae22
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
test -f /usr/share/doc/kitware-archive-keyring/copyright ||
sudo rm /usr/share/keyrings/kitware-archive-keyring.gpg
sudo apt-get install kitware-archive-keyring
sudo apt install -y file build-essential cmake debmake dh-make ninja-build wget gettext p7zip-full libsdl2-dev
sudo apt install -y file build-essential cmake ninja-build wget gettext p7zip-full libsdl2-dev
- name: Checkout
uses: actions/checkout@v4
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/build_deb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Build Deb Workflow
on:
workflow_run:
workflows: [Build Workflow]
types: [completed]
inputs:
build_type:
description: 'Build Configuration to use (Debug, Release, RelWithDebInfo or MinSizeRel).'
required: false
default: 'Release'

jobs:
Linux-64:
name: Linux x64
runs-on: ubuntu-latest
container: ubuntu:22.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Set build configuration
id: build_configuration
run: |
BUILD_TYPE=${{github.event.inputs.build_type}}
echo "build_type=${BUILD_TYPE:-"Debug"}" >> $GITHUB_OUTPUT
- name: Setup Dependencies
run: |
apt update -y && apt install -y sudo
sudo apt-get update -y
sudo apt-get install -y ca-certificates gpg wget
test -f /usr/share/doc/kitware-archive-keyring/copyright ||
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
sudo apt-get update -y
test -f /usr/share/doc/kitware-archive-keyring/copyright ||
sudo rm /usr/share/keyrings/kitware-archive-keyring.gpg
sudo apt-get install kitware-archive-keyring
sudo apt install -y file build-essential cmake ninja-build wget gettext p7zip-full libsdl2-dev
- name: Download source package
uses: actions/github-script@v7
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "Linux-x64"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/Linux-x64.zip`, Buffer.from(download.data));
- name: Package Debian
run: |
sudo apt install -y debmake debhelper dh-make
7z x Linux-x64.zip -aoa -bd -y
mkdir -p Debian/Linux-x64
tar zxf Linux-x64/max-port-*-Source.tar.gz --directory=Debian/Linux-x64
cd Debian/Linux-x64/max-port-*-Source
sh ../../../.github/workflows/scripts/linux/get-dependencies cmake/versions.cmake
debmake --tar --monoarch --invoke debuild
cp ../max-port_*_amd64.deb ../../../${{steps.build_configuration.outputs.build_type}}/Artifacts2/Linux-x64/
cp ../max-port-dbgsym_*_amd64.ddeb ../../../${{steps.build_configuration.outputs.build_type}}/Artifacts2/Linux-x64/
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{github.job}}
path: ${{steps.build_configuration.outputs.build_type}}/Artifacts2
2 changes: 2 additions & 0 deletions cmake/enet.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ if(ENET_RELEASE)
URL_HASH ${ENET_HASH_TYPE}=${ENET_HASH}
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
OVERRIDE_FIND_PACKAGE
EXCLUDE_FROM_ALL
)
else()
FetchContent_Declare(
Expand All @@ -26,6 +27,7 @@ else()
GIT_TAG ${ENET_TAG}
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
OVERRIDE_FIND_PACKAGE
EXCLUDE_FROM_ALL
)
endif()

Expand Down
9 changes: 8 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/make -f
# Output every command that modifies files on the build system.
#export DH_VERBOSE = 1
export DH_VERBOSE = 1

# Make sure architecture is defined
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

# Apply all hardening options
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
Expand All @@ -25,6 +28,10 @@ override_dh_auto_configure:
-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-linux-x86_64.cmake \
-DBUILD_SHARED_LIBS=ON

# Manually add search path
override_dh_shlibdeps:
dh_shlibdeps -l$(CURDIR)/debian/max-port/usr/lib/$(DEB_HOST_MULTIARCH)/max-port/

# You may need to patch CMakeLists.txt to set the library install path to be:
#-install(TARGETS <sharedlibname> LIBRARY DESTINATION lib)
#+install(TARGETS <sharedlibname> LIBRARY DESTINATION lib/${CMAKE_LIBRARY_ARCHITECTURE})
Expand Down

0 comments on commit 25dae22

Please sign in to comment.