Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Meowchestra committed Jan 26, 2025
1 parent 08c8886 commit 920102f
Show file tree
Hide file tree
Showing 9 changed files with 178 additions and 98 deletions.
44 changes: 20 additions & 24 deletions .github/workflows/xmake-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
jobs:
build:
runs-on: windows-latest
if: always()

steps:
- uses: xmake-io/github-action-setup-xmake@v1
Expand All @@ -22,9 +21,9 @@ jobs:
arch: 'win64_msvc2022_64'
modules: 'qtmultimedia'

- name: update repo
run: |
xrepo update-repo
- uses: jmarrec/setup-qtifw@v1
with:
qtifw-version: '4.x'

- uses: actions/checkout@v4
with:
Expand All @@ -36,35 +35,32 @@ jobs:
path: build/website
fetch-depth: 1

- name: cache packages from xrepo
uses: actions/cache@v4
with:
path: |
${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
key: ${{ runner.os }}-xrepo-qt-${{ hashFiles('scripts/xmake/packages.lua') }}

- name: cache xmake
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.xmake/**/cache
${{ github.workspace }}/build/.build_cache
${{ github.workspace }}/build/.deps
${{ github.workspace }}/build/.gens
${{ github.workspace }}/build/.objs
key: ${{ runner.os }}-xmake-build-${{ hashFiles('**/xmake.lua') }}

- name: Setup graphviz
run: |
choco install graphviz doxygen.install
- name: install by xmake
- name: Build
run: |
xmake config --yes --mode=release --generate-repository=y
xmake build --jobs=2
xmake install installer
xmake doxygen --yes
- name: Copy Files
shell: pwsh
run: |
mkdir ./packaging/org.midieditor.midieditor/data/
cp ./bin/ProMidEdit.exe ./packaging/org.midieditor.midieditor/data/ProMidEdit.exe
windeployqt ./packaging/org.midieditor.midieditor/data/ProMidEdit.exe
mkdir ./packaging/org.midieditor.midieditor/data/metronome
cp ./run_environment/metronome/metronome-01.wav ./packaging/org.midieditor.midieditor/data/metronome
mkdir ./packaging/org.midieditor.manual/data/
cp -Recurse -Path ./manual/ -Destination ./packaging/org.midieditor.manual/data/
- name: Packaging
shell: cmd
run: |
binarycreator.exe --offline-only -c .\scripts\packaging\windows\config.xml -p .\packaging Install.exe
- name: Release installer
uses: softprops/action-gh-release@v2
with:
Expand Down
61 changes: 27 additions & 34 deletions .github/workflows/xmake.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ on:
push:
branches:
- 'main'
paths:
- '**.c'
- '**.cpp'
- '**.h'
- '**.hpp'
- '**.rc'
- '**.qrc'
- '**.ts'
- '**.lua'
- '.github/workflows/xmake.yaml'

jobs:
build:
Expand All @@ -32,41 +22,44 @@ jobs:
arch: 'win64_msvc2022_64'
modules: 'qtmultimedia'

- name: update repo
run: |
xrepo update-repo
- uses: jmarrec/setup-qtifw@v1
with:
qtifw-version: '4.x'

- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: cache packages from xrepo
uses: actions/cache@v4
with:
path: |
${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
key: ${{ runner.os }}-xrepo-qt-${{ hashFiles('scripts/xmake/packages.lua') }}
- name: Build
run: |
xmake config --yes
xmake build --jobs=2
- name: cache xmake
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.xmake/**/cache
${{ github.workspace }}/build/.build_cache
${{ github.workspace }}/build/.deps
${{ github.workspace }}/build/.gens
${{ github.workspace }}/build/.objs
key: ${{ runner.os }}-xmake-build-${{ hashFiles('**/xmake.lua') }}
- name: Copy Files
shell: pwsh
run: |
mkdir ./packaging/org.midieditor.midieditor/data/
cp ./bin/ProMidEdit.exe ./packaging/org.midieditor.midieditor/data/ProMidEdit.exe
windeployqt ./packaging/org.midieditor.midieditor/data/ProMidEdit.exe
mkdir ./packaging/org.midieditor.midieditor/data/metronome
cp ./run_environment/metronome/metronome-01.wav ./packaging/org.midieditor.midieditor/data/metronome
mkdir ./packaging/org.midieditor.manual/data/
cp -Recurse -Path ./manual/ -Destination ./packaging/org.midieditor.manual/data/
- name: config by xmake
- name: Packaging
shell: cmd
run: |
xmake config --yes --verbose --diagnosis
binarycreator.exe --offline-only -c .\scripts\packaging\windows\config.xml -p .\packaging Install.exe
- name: build and create installer
- name: List build contents
shell: cmd
run: |
xmake build --verbose --diagnosis --jobs=2
xmake install installer
echo "Listing packaging directory contents:"
dir /s packaging
echo "Listing build directory contents:"
dir /s build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
Expand Down
12 changes: 12 additions & 0 deletions scripts/packaging/debian/ProMidEdit.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

[Desktop Entry]
Version=1.0.0
Encoding=UTF-8
Name=ProMidEdit
Comment=NONE
Exec=promidedit
Icon=midieditor.png
Terminal=false
Type=Application
Categories=AudioVideo;Audio;
Name[ru_RU]=ProMidEdit.desktop
23 changes: 23 additions & 0 deletions scripts/packaging/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Package: promidedit
Version: {VERSION}-{PACKAGE}
Section: sound
Priority: extra
Architecture: {ARCH}
Depends: {DEPENDS}
Installed-Size: {SIZE}
Maintainer: PROPHESSOR, Markus Schwenk <[email protected]>
Homepage: https://midieditor.org/
Description: Graphical interface to edit, play, and record Midi data.
ProMidEdit is a free software providing an interface to edit,
record, and play Midi data.
.
The editor is able to open existing Midi files and modify their
content. New files can be created and the user can enter his own
composition by either recording Midi data from a connected Midi device
(e.g., a digital piano or a keyboard) or by manually creating new
notes and other Midi events. The recorded data can be easily
quantified and edited afterwards using ProMidEdit.
.
ProMidEdit was developed by PROPHESSOR based on Markus Schwenk's MidiEditor. It is entirely written in C++ (Qt 5)
and is available for the platforms Linux and Windows.
Support languages: English and Russian
12 changes: 12 additions & 0 deletions scripts/packaging/debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
This package was debianized on {DATE}.

Copyright (c) by PROPHESSOR 2019.

It was downloaded from https://github.com/PROPHESSOR/ProMidEdit

Upstream Author: Markus Schwenk <[email protected]>

This code is released under the terms of the GPL license version 3.

See /usr/share/common-licenses/GPL-3 for the full license.

Binary file added scripts/packaging/debian/promidedit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion scripts/packaging/windows/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<RunProgram>@TargetDir@/ProMidEdit.exe</RunProgram>
<RunProgramArguments>
</RunProgramArguments>
<RunProgramDescription>Run ProMidEdit</RunProgramDescription>
<RunProgramDescription>run midieditor</RunProgramDescription>
<StartMenuDir>ProMidEdit</StartMenuDir>
<AllowNonAsciiCharacters>true</AllowNonAsciiCharacters>

Expand Down
3 changes: 0 additions & 3 deletions scripts/xmake/packages.lua

This file was deleted.

119 changes: 83 additions & 36 deletions xmake.lua
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@

local MIDIEDITOR_RELEASE_VERSION_STRING = "3.9.0"
set_version(MIDIEDITOR_RELEASE_VERSION_STRING)
set_allowedplats("windows")
set_allowedplats("windows", "linux", "macosx")

option("generate-repository", {
description = "generate repositiory to update online repositories",
default = false,
values = {true, false},
showmenu = true,
})

includes("scripts/xmake/packages.lua")
add_all_requires()
option("libraries-from-apt", {
description = "use libraries from apt rather than xmake-repo",
default = false,
values = {true, false},
showmenu = is_host("linux") and (linuxos.name() == "ubuntu"),
})

local installdir = "packaging/org.midieditor.midieditor/data/"
target("ProMidEdit") do
set_languages("cxx17")
add_rules("qt.widgetapp")

-- Add Qt6 multimedia include paths explicitly
after_load(function (target)
local qt_dir = os.getenv("QTDIR")
if qt_dir then
target:add("includedirs", path.join(qt_dir, "include/QtMultimedia"))
target:add("includedirs", path.join(qt_dir, "include/QtMultimediaWidgets"))
end
end)
set_targetdir("bin")

add_packages({
"qt6widgets"
})
add_rules("qt.widgetapp")
add_frameworks({
"QtGui",
"QtWidgets",
"QtWidgets",
"QtCore",
"QtNetwork",
"QtXml",
Expand All @@ -45,10 +43,21 @@ target("ProMidEdit") do
add_defines("MIDIEDITOR_RELEASE_VERSION_ID_DEF=" .. 0)
add_defines("MIDIEDITOR_RELEASE_DATE_DEF=" .. os.date("%x"))
add_defines("MIDIEDITOR_RELEASE_VERSION_STRING_DEF=" .. MIDIEDITOR_RELEASE_VERSION_STRING)
if is_plat("windows") then
if is_plat("linux", "bsd") then
add_defines({
"__LINUX_ALSASEQ__",
"__LINUX_ALSA__"
})
add_syslinks("asound")
elseif is_plat("windows") then
add_defines("__WINDOWS_MM__")
add_syslinks("winmm")
add_files("midieditor.rc")
elseif is_plat("macosx") then
add_defines("__MACOSX_CORE__")
add_frameworks("CoreMidi", "CoreAudio", "CoreFoundation")
-- TODO: icons
add_installfiles("midieditor.icns")
end

local bindir = path.join(installdir, "bin")
Expand All @@ -72,12 +81,14 @@ end

target("manual") do
set_kind("phony")
set_enabled(is_plat("windows"))
set_installdir("packaging/org.midieditor.manual/data/manual")
add_installfiles("manual/(**)")
end

target("installer")
target("installer") do
set_kind("phony")
set_enabled(is_plat("windows", "linux"))
add_deps("ProMidEdit")

set_installdir(installdir)
Expand All @@ -86,26 +97,62 @@ target("installer")
add_packages("qtifw")
after_install(function (target, opt)
import("core.project.config")

-- Create required directories
os.mkdir("packaging/org.midieditor.midieditor/data/bin")

-- Copy all files from release directory
os.cp("build/windows/x64/release/*", "packaging/org.midieditor.midieditor/data/bin/")

-- Copy additional resources
-- os.cp("run_environment/**", "packaging/org.midieditor.midieditor/data/")

-- Generate installer
local qtifw_dir = target:pkg("qtifw"):installdir()
local binarycreator_path = path.join(qtifw_dir, "/bin/binarycreator.exe")

print("generate off-line installer")
local package_argv = {
"--config", "scripts/packaging/windows/config.xml",
"--packages", "packaging",
"packaging/Install.exe"
local repogen_path = path.join(qtifw_dir, "/bin/repogen.exe")
if config.get("generate-repository") then
print("generate site")
print(" generate repository")
local repo_argv = {
"--update-new-components",
"--packages", "packaging",
path.join(config.buildir(), "website", "repository")
}
os.iorunv(repogen_path, repo_argv)
print(" generate installer")
local package_argv = {
"--config", "scripts/packaging/windows/config.xml",
"--packages", "packaging",
path.join(config.buildir(), "website", "ProMidiEdit.exe")
}
os.iorunv(binarycreator_path, package_argv)
print(" copy online manual")
os.cp("manual/*", path.join(config.buildir(), "website"))
else
print("generate off-line installer")
local package_argv = {
"--config", "scripts/packaging/windows/config.xml",
"--packages", "packaging",
"packaging/Install.exe"
}
os.iorunv(binarycreator_path, package_argv)
end
end)
elseif is_plat("linux") and linuxos.name() == "ubuntu" then
add_installfiles("scripts/packaging/debian/ProMidEdit.desktop", {prefixdir = "usr/share/applications"})
add_installfiles("scripts/packaging/debian/logo48.png", {prefixdir = "usr/share/pixmaps"})
add_installfiles("scripts/packaging/debian/copyright", {prefixdir = "usr/share/doc/promidedit/copyright"})
add_installfiles("$(buildir)/control", {prefixdir = "DEBIAN"})
add_configfiles("scripts/packaging/debian/control", {
pattern = "{(.-)}",
variables = {
PACKAGE = 1,
DEPENDS = "libc6(>=2.19), libfluidsynth3, qtbase5-dev, qtdeclarative5-dev, libqt5webkit5-dev, libsqlite3-dev, qt5-default, qtmultimedia5-dev, libqt5multimedia5, qttools5-dev-tools, libqt5multimedia5-plugins, libasound2, libgstreamer1.0-0, gstreamer1.0-plugins-base, gstreamer1.0-plugins-good, gstreamer1.0-plugins-bad, gstreamer1.0-plugins-ugly, gstreamer1.0-libav, gstreamer1.0-doc, gstreamer1.0-tools",
SIZE = 70, -- in kb, todo
}
os.iorunv(binarycreator_path, package_argv)
})
after_install(function (target, opt)
import("core.project.config")
local installdir_glob = path.join(target:installdir(), "**")
for _, file in ipairs(os.dirs(installdir_glob)) do
os.runv("chmod", {"755", file})
end
for _, file in ipairs(os.files(installdir_glob)) do
os.runv("chmod", {"644", file})
end
os.runv("chmod", {
"+x", path.join(target:installdir(), "bin", target:deps()["ProMidEdit"]:filename())})
os.iorunv("fakeroot", {"dpkg-deb", "--build", target:installdir()})
end)
end
end
end

0 comments on commit 920102f

Please sign in to comment.