Skip to content

Commit

Permalink
Icons, deb builder and metadata fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzen committed Oct 26, 2023
1 parent b378082 commit 0031aa9
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 46 deletions.
19 changes: 19 additions & 0 deletions client/cmd/dexc-desktop/pkg/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

# This file defines common variables to be source'd by the various build scripts
# in this directory.

# pick up the release tag from git
VER=$(git describe --tags --abbrev=0 | sed -e 's/^v//')
META= # "release"
REV="0"

APP="dexc"
ARCH="amd64"

# The build directory will be deleted at the beginning of every build. The
# directory is .gitignore'd.
BUILD_DIR="./build"

# DEB_NAME follows the prescribed format for debian packaging.
DEB_NAME="${APP}_${VER}-${REV}_${ARCH}"

68 changes: 22 additions & 46 deletions client/cmd/dexc-desktop/pkg/pkg-debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,12 @@
# A good getting-started guide for Debian packaging can be found at
# https://www.internalpointers.com/post/build-binary-deb-package-practical-guide

set -ex
# turn this on for debugging, keep noise low for prod builds
# set -ex

APP="dexc"
VER="0.7.0-pre"
META= # "release"
REV="0"
ARCH="amd64"
source $(dirname "$0")/common.sh

# DEB_NAME follows the prescribed format for debian packaging.
DEB_NAME="${APP}_${VER}-${REV}_${ARCH}"

# The build directory will be deleted at the beginning of every build. The
# directory is .gitignore'd.
BUILD_DIR="./build"

# A directory for binary source files e.g. image files.
# A directory containing metadata files
SRC_DIR="./src"

# The DEB_DIR represents the root directory in our target system. The directory
Expand All @@ -36,16 +26,11 @@ POSTINST_PATH="${CONTROL_DIR}/postinst"
POSTRM_PATH="${CONTROL_DIR}/postrm"

# The dexc binary.
BIN_TARGETDIR="/usr/lib/dexc"
BIN_TARGETDIR="/usr/bin"
BIN_BUILDDIR="${DEB_DIR}${BIN_TARGETDIR}"
BIN_FILENAME="${APP}"
BIN_BUILDPATH="${BIN_BUILDDIR}/${BIN_FILENAME}"

ICON_FILENAME="dexc.png"
SRC_TARGETDIR="${BIN_TARGETDIR}/src"
SRC_BUILDDIR="${DEB_DIR}${SRC_TARGETDIR}"
LIBICON_BUILDPATH="${SRC_BUILDDIR}/${ICON_FILENAME}"

# The Desktop Entry is a format for "installing" programs on Linux, creating
# an entry in the main menu.
# https://specifications.freedesktop.org/desktop-entry-spec/latest/
Expand All @@ -54,18 +39,10 @@ DOT_DESKTOP_BUILDDIR="${DEB_DIR}${DOT_DESKTOP_TARGETDIR}"
DOT_DESKTOP_FILENAME="dexc.desktop"
DOT_DESKTOP_BUILDPATH="${DOT_DESKTOP_BUILDDIR}/${DOT_DESKTOP_FILENAME}"

# This will be the icon shown for the program in the taskbar. I know that both
# PNG and SVG will work. If it's a bitmap, should probably be >= 128 x 128 px.
ICON_TARGETDIR="/usr/share/pixmaps"
ICON_BUILDDIR="${DEB_DIR}${ICON_TARGETDIR}"
DESKTOPICON_BUILDPATH="${ICON_BUILDDIR}/${ICON_FILENAME}"

# Prepare the directory structure.
rm -fr "${BUILD_DIR}"
mkdir -p -m 0755 "${CONTROL_DIR}"
mkdir -p "${SRC_BUILDDIR}" # subdir of BIN_BUILDDIR
mkdir -p "${DOT_DESKTOP_BUILDDIR}"
mkdir -p "${ICON_BUILDDIR}"

# Build dexc
LDFLAGS="-s -w -X main.Version=${VER}${META:++${META}}"
Expand All @@ -83,40 +60,39 @@ Depends: libgtk-3-0, libwebkit2gtk-4.0-37
Description: A multi-wallet backed by Decred DEX
EOF

# Symlink the binary and update the desktop icons, refresh the "start" menu.
# Copy icons
# This will be the icon shown for the program in the taskbar. I know that both
# PNG and SVG will work. If it's a bitmap, should probably be >= 128 x 128 px.
ICON_TARGETDIR="/usr/share/icons/hicolor"
ICON_BUILDDIR="${DEB_DIR}${ICON_TARGETDIR}"
install -Dm644 -t "${ICON_BUILDDIR}/scalable/apps" "${SRC_DIR}/dexc.svg"
install -Dm644 -t "${ICON_BUILDDIR}/128x128/apps" "${SRC_DIR}/dexc.png"
install -Dm644 -t "${ICON_BUILDDIR}/symbolic/apps" "${SRC_DIR}/dexc-symbolic.svg"

# AppStream metadata
# https://wiki.debian.org/AppStream
install -Dm644 -t "${DEB_DIR}/usr/share/metainfo" "${SRC_DIR}/org.decred.dcrdex.metainfo.xml"

# Update the desktop icons, refresh the "start" menu.
cat > "${POSTINST_PATH}" <<EOF
ln -s "${BIN_TARGETDIR}/${BIN_FILENAME}" "/usr/bin/${BIN_FILENAME}"
update-desktop-database
EOF
chmod 775 "${POSTINST_PATH}"

# Remove symlink from postinst.
cat > "${POSTRM_PATH}" <<EOF
rm "/usr/bin/${BIN_FILENAME}"
EOF
chmod 775 "${POSTRM_PATH}"

# Example file:
# https://specifications.freedesktop.org/desktop-entry-spec/latest/apa.html
cat > "${DOT_DESKTOP_BUILDPATH}" <<EOF
[Desktop Entry]
Version=${VER}
Name=Decred DEX Client
Comment=Multi-wallet backed by Decred DEX
Exec=${BIN_TARGETDIR}/${BIN_FILENAME}
Icon=${ICON_TARGETDIR}/${ICON_FILENAME}
Exec=${BIN_FILENAME}
Icon=${APP}
Terminal=false
Type=Application
Categories=Office;Development;
Categories=Office;Finance;
EOF
chmod 644 "${DOT_DESKTOP_BUILDPATH}"

# Icon
cp "${SRC_DIR}/${ICON_FILENAME}" "${DESKTOPICON_BUILDPATH}"
chmod 644 "${DESKTOPICON_BUILDPATH}"

cp "${SRC_DIR}/${ICON_FILENAME}" "${LIBICON_BUILDPATH}"
chmod 644 "${LIBICON_BUILDPATH}"

# Build the installation archive (.deb file).
dpkg-deb --build --root-owner-group "${DEB_DIR}"
7 changes: 7 additions & 0 deletions client/cmd/dexc-desktop/src/dexc-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified client/cmd/dexc-desktop/src/dexc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions client/cmd/dexc-desktop/src/dexc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions client/cmd/dexc-desktop/src/org.decred.dcrdex.metainfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>org.decred.dcrdex</id>
<launchable type="desktop-id">org.decred.dcrdex.desktop</launchable>
<name>DCRDEX</name>
<summary>Decentralized cryptocurrency exchange</summary>
<metadata_license>MIT</metadata_license>
<project_license>BlueOak-1.0.0</project_license>
<url type="homepage">https://dex.decred.org</url>
<url type="help">https://chat.decred.org/#/room/#dex:decred.org</url>
<developer_name>The Decred Developers</developer_name>
<description>
<p>
Non-custodial peer-to-peer exchange where your funds never leave your wallet.
Trade Bitcoin, USDC, Ethereum, Decred, Dogecoin, Zcash and more without KYC
and fees, using atomic swaps technology.
</p>
</description>
</component>

0 comments on commit 0031aa9

Please sign in to comment.