diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index acfa329..deefec8 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -14,5 +14,14 @@ RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \ # RUN su vscode -c "${VCPKG_ROOT}/vcpkg install " # [Optional] Uncomment this section to install additional packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends \ + qt5-default \ + qtdeclarative5-dev \ + libqt5quick5 \ + libqt5quickcontrols2-5 \ + libqt5serialport5-dev \ + mesa-common-dev \ + libglu1-mesa-dev \ + qtquickcontrols2-5-dev \ + libqt5opengl5-dev diff --git a/linux_deploy/control b/linux_deploy/control new file mode 100755 index 0000000..eee8bd6 --- /dev/null +++ b/linux_deploy/control @@ -0,0 +1,7 @@ +Package: data-plotter +Version: {version} +Architecture: amd64 +Essential: no +Priority: optional +Maintainer: Jiri Maier +Description: Universal GUI for software-defined measuring instruments diff --git a/linux_deploy/data-plotter.desktop b/linux_deploy/data-plotter.desktop new file mode 100644 index 0000000..ca421da --- /dev/null +++ b/linux_deploy/data-plotter.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=Data Plotter +Comment=Universal GUI for software-defined measuring instruments +Exec=/usr/bin/data-plotter +Icon=/usr/share/icons/hicolor/256x256/apps/data-plotter.png +Categories=Office \ No newline at end of file diff --git a/linux_deploy/deploy.py b/linux_deploy/deploy.py new file mode 100644 index 0000000..b2d543e --- /dev/null +++ b/linux_deploy/deploy.py @@ -0,0 +1,77 @@ +import os +import shutil +import subprocess + +# Function to get the version from the .pro file +def get_version(file_path): + with open(file_path, 'r') as file: + for line in file: + if line.startswith('VERSION'): + return line.split('=')[1].strip() + return None + + +# Get the version from the .pro file +version = get_version('DataPlotter.pro') +# Trim the version to three numbers +version = ".".join(version.split(".")[:3]) + +# Define the base directory +base_dir = os.path.join("linux_deploy",f"data-plotter_{version}_amd64") + +if os.path.exists(base_dir): + shutil.rmtree(base_dir) + +# Define the directories to be created +dirs = [ + os.path.join(base_dir, "DEBIAN"), + os.path.join(base_dir, "usr", "bin"), + os.path.join(base_dir, "usr", "share", "doc", "data-plotter"), + os.path.join(base_dir, "usr", "lib"), + os.path.join(base_dir,"usr","share","icons","hicolor","256x256","apps"), + os.path.join(base_dir,"usr","share","applications"), +] + +# Create the directories +for dir in dirs: + os.makedirs(dir, exist_ok=True) + +# Define the files to be copied +files = { + os.path.join("linux_deploy","control"): os.path.join(base_dir, "DEBIAN", "control"), + os.path.join("linux_deploy","qt.conf"): os.path.join(base_dir, "usr", "bin", "qt.conf"), + os.path.join("build","DataPlotter"): os.path.join(base_dir, "usr", "bin", "data-plotter"), + os.path.join("documentation","license.txt"): os.path.join(base_dir, "usr", "share", "doc", "data-plotter", "copyright"), + os.path.join("linux_deploy","icon.png"):os.path.join(base_dir,"usr","share","icons","hicolor","256x256","apps","data-plotter.png"), + os.path.join("linux_deploy","data-plotter.desktop"):os.path.join(base_dir,"usr","share","applications","data-plotter.desktop") +} + +# Copy the files +for src, dst in files.items(): + shutil.copy(src, dst) + +with open(os.path.join(base_dir, "DEBIAN", "control"), "r") as file: + content = file.read() +content = content.replace("{version}", f"{version}") +with open(os.path.join(base_dir, "DEBIAN", "control"), "w") as file: + file.write(content) + +# Run ldd on the executable +result = subprocess.run(["ldd", os.path.join("build","DataPlotter")], capture_output=True, text=True) + +# Extract the paths of the shared libraries +libs = [line.split(" ")[2] for line in result.stdout.splitlines() if "=>" in line and not "linux-vdso" in line] + +for lib in libs: + shutil.copy(lib, os.path.join(base_dir, "usr", "lib")) + +shutil.copytree(os.path.join("linux_deploy","plugins"),os.path.join(base_dir,"usr","lib","qt5","plugins")) +shutil.copytree(os.path.join("linux_deploy","qml"),os.path.join(base_dir,"usr","lib","qt5","qml")) + +# Print a success message +print(f"The Debian package folder structure for {base_dir} has been created and the files have been copied.") + +os.remove(base_dir + ".deb") + +#result = subprocess.run(["dpkg-deb", "--build", base_dir], capture_output=True, text=True) +#print(result) \ No newline at end of file diff --git a/linux_deploy/icon.png b/linux_deploy/icon.png new file mode 100644 index 0000000..0c47607 Binary files /dev/null and b/linux_deploy/icon.png differ diff --git a/linux_deploy/qt.conf b/linux_deploy/qt.conf new file mode 100644 index 0000000..42f2f38 --- /dev/null +++ b/linux_deploy/qt.conf @@ -0,0 +1,5 @@ +[Paths] +Prefix = /usr/lib/qt5/ +Plugins = plugins +Imports = qml +Qml2Imports = qml \ No newline at end of file