You are not logged in.
I am rather new to creating and modifying packages, but out of necessity I have been trying to modify the existing modustoolbox package on the AUR to build the newest 2.0.0 version rather than the 1.1.0 version the package is currently left at. Despite somehow managing to get the package installed and running successfully, the program now requires an environment variable pointing to a folder within the installation directory to be set before I can do anything useful with it. What is the best way to go about doing this within the package?
The environment variable I need to set is:
CY_TOOLS_PATHS=/opt/ModusToolbox/tools_2.0/
My current PKGBUILD file is:
pkgname=modustoolbox
pkgver=2.0.0
pkgrel=234
pkgdesc="ModusToolbox simplifies development for IoT designers. IDE for PSoC 6"
arch=('x86_64')
license=(custom)
depends=('make' 'coreutils' 'perl' 'diffutils')
url="https://www.cypress.com/products/modustoolbox-software-environment"
options=('!strip')
source=(http://dlm.cypress.com.edgesuite.net/akdlm/downloadmanager/WICED_MODUS/P-ModusToolbox_2.0.0.1703-linux-install.tar.gz)
sha256sums=('8726d73c5f7bf7cb29d4d245b30ad2954922f4e40a12fdaedd5be83658b691f8')
package() {
cd "${srcdir}"
install -d -m755 "${pkgdir}/opt/${pkgname}"
cp -r "${srcdir}/ModusToolbox/" "${pkgdir}/opt/"
# Installing udev rules
install -Dm644 "${srcdir}/ModusToolbox/tools_2.0/fw-loader/udev_rules/57-cypress_programmer.rules" "${pkgdir}/etc/udev/rules.d/57-cypress_programmer.rules"
install -Dm644 "${srcdir}/ModusToolbox/tools_2.0/openocd/udev_rules/60-openocd.rules" "${pkgdir}/etc/udev/rules.d/60-opencd.rules"
install -Dm644 "${srcdir}/ModusToolbox/tools_2.0/openocd/udev_rules/66-wiced-JTAG.rules" "${pkgdir}/etc/udev/rules.d/66-wiced-JTAG.rules"
install -Dm644 "${srcdir}/ModusToolbox/tools_2.0/driver_media/67-wiced-JTAG.rules" "${pkgdir}/etc/udev/rules.d/67-wiced-JTAG.rules"
install -Dm644 "${srcdir}/ModusToolbox/tools_2.0/driver_media/cypress_ftdi.sh" "${pkgdir}/opt/cypress/cypress_ftdi.sh"
install -Dm644 "${srcdir}/ModusToolbox/tools_2.0/driver_media/cypress_cdc_acm.sh" "${pkgdir}/opt/cypress/cypress_cdc_acm.sh"
# Run final install script
sh ${srcdir}/ModusToolbox/tools_2.0/modus-shell/postinstall
# symbolic link to make
ln -sf /usr/bin/make ${pkgdir}/opt/ModusToolbox/tools_2.0/modus-shell/bin/make
# Installing desktop shortcuts
install -d -m755 "${pkgdir}/usr/share/applications"
cat <<EOF > "${pkgdir}/usr/share/applications/ModusToolbox-x86_64-${pkgver}.desktop"
[Desktop Entry]
Name=ModusToolbox
Version=${pkgver}
Comment=${pkgdesc}
GenericName=ModusToolbox
Exec=/opt/ModusToolbox/ide_2.0/eclipse/ModusToolbox
Icon=/opt/ModusToolbox/ide_2.0/eclipse/icon.xpm
Path=/opt/ModusToolbox/ide_2.0/eclipse/
Terminal=false
StartupNotify=true
Type=Application
Categories=Development
EOF
}
Feel free to critique any unrelated mistakes or bad practices that may be obvious in what I have done so far too. I would greatly appreciate any feedback that gives me the opportunity to improve.
Last edited by Brunste (2019-11-25 23:02:46)
Offline
the program now requires an environment variable pointing to a folder within the installation directory to be set before I can do anything useful with it.
The variable needs to be set in the runtime environment right, not (just) at build time? If so, just include a file to be installed to /etc/profile.d/ that sets the variable.
I'm glad you did not try to run all their install scripts but instead just copied over those udev rules directly - their scripts would not have worked. As for the postinstall script, if that is to do anything useful at all, it will need to be be moved to the pkgdir before being executed - but this one too should just be done manually. It just creates (tries to create) a handful of symlinks.
Also note that the pkgname should be modustoolbox-bin as this is distributing precompiled binaries.
Last edited by Trilby (2019-11-23 00:10:44)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
With a custom license you need to copy the license file(s) to the correct location, https://wiki.archlinux.org/index.php/PKGBUILD#license
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
Thank you all for your suggestions. I rebuilt and installed the package again and it seems to be working. I'll include the updated copy of my PKGBUILD below and mark this thread as solved.
pkgname=modustoolbox-bin
pkgver=2.0.0
pkgrel=234
pkgdesc="Set of multi-platform development tools by Cypress. IDE for PSoC 6"
arch=('x86_64')
license=(custom)
depends=('make' 'coreutils' 'perl' 'diffutils')
url="https://www.cypress.com/products/modustoolbox-software-environment"
options=('!strip')
source=(http://dlm.cypress.com.edgesuite.net/akdlm/downloadmanager/WICED_MODUS/P-ModusToolbox_2.0.0.1703-linux-install.tar.gz)
sha256sums=('8726d73c5f7bf7cb29d4d245b30ad2954922f4e40a12fdaedd5be83658b691f8')
package() {
cd "${srcdir}"
install -d -m755 "${pkgdir}/opt/${pkgname}"
cp -r "${srcdir}/ModusToolbox/" "${pkgdir}/opt/"
# Create environment variable
echo "EXPORT CY_TOOLS_PATHS=/opt/ModusToolbox/tools_2.0/" >> ${srcdir}/modustoolbox
install -Dm644 "${srcdir}/modustoolbox" "{$pkgdir}/etc/profile.d/modustoolbox"
# Installing udev rules
install -Dm644 "${srcdir}/ModusToolbox/tools_2.0/fw-loader/udev_rules/57-cypress_programmer.rules" "${pkgdir}/etc/udev/rules.d/57-cypress_programmer.rules"
install -Dm644 "${srcdir}/ModusToolbox/tools_2.0/openocd/udev_rules/60-openocd.rules" "${pkgdir}/etc/udev/rules.d/60-opencd.rules"
install -Dm644 "${srcdir}/ModusToolbox/tools_2.0/openocd/udev_rules/66-wiced-JTAG.rules" "${pkgdir}/etc/udev/rules.d/66-wiced-JTAG.rules"
install -Dm644 "${srcdir}/ModusToolbox/tools_2.0/driver_media/67-wiced-JTAG.rules" "${pkgdir}/etc/udev/rules.d/67-wiced-JTAG.rules"
install -Dm644 "${srcdir}/ModusToolbox/tools_2.0/driver_media/cypress_ftdi.sh" "${pkgdir}/opt/cypress/cypress_ftdi.sh"
install -Dm644 "${srcdir}/ModusToolbox/tools_2.0/driver_media/cypress_cdc_acm.sh" "${pkgdir}/opt/cypress/cypress_cdc_acm.sh"
# Install license
install -Dm644 "${srcdir}/ModusToolbox/CYPRESS END USER LICENSE AGREEMENT.txt" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
# symbolic link to tools
ln -sf /usr/bin/cat ${pkgdir}/opt/ModusToolbox/tools_2.0/modus-shell/bin/cat
ln -sf /usr/bin/cp ${pkgdir}/opt/ModusToolbox/tools_2.0/modus-shell/bin/cp
ln -sf /usr/bin/make ${pkgdir}/opt/ModusToolbox/tools_2.0/modus-shell/bin/make
ln -sf /usr/bin/mkdir ${pkgdir}/opt/ModusToolbox/tools_2.0/modus-shell/bin/mkdir
ln -sf /usr/bin/mktemp ${pkgdir}/opt/ModusToolbox/tools_2.0/modus-shell/bin/mktemp
ln -sf /usr/bin/mv ${pkgdir}/opt/ModusToolbox/tools_2.0/modus-shell/bin/mv
ln -sf /usr/bin/perl ${pkgdir}/opt/ModusToolbox/tools_2.0/modus-shell/bin/perl
ln -sf /usr/bin/rm ${pkgdir}/opt/ModusToolbox/tools_2.0/modus-shell/bin/rm
ln -sf /usr/bin/rmdir ${pkgdir}/opt/ModusToolbox/tools_2.0/modus-shell/bin/rmdir
ln -sf /usr/bin/sh ${pkgdir}/opt/ModusToolbox/tools_2.0/modus-shell/bin/sh
ln -sf /usr/bin/bash ${pkgdir}/opt/ModusToolbox/tools_2.0/modus-shell/bin/bash
# Installing desktop shortcuts
install -d -m755 "${pkgdir}/usr/share/applications"
cat <<EOF > "${pkgdir}/usr/share/applications/ModusToolbox-x86_64-${pkgver}.desktop"
[Desktop Entry]
Name=ModusToolbox
Version=${pkgver}
Comment=${pkgdesc}
GenericName=ModusToolbox
Exec=/opt/ModusToolbox/ide_2.0/eclipse/ModusToolbox
Icon=/opt/ModusToolbox/ide_2.0/eclipse/icon.xpm
Path=/opt/ModusToolbox/ide_2.0/eclipse/
Terminal=false
StartupNotify=true
Type=Application
Categories=Development
EOF
}
Last edited by Brunste (2019-11-26 15:13:04)
Offline
The pkgdesc variable shouldn't contain the name of the program...
https://wiki.archlinux.org/index.php/PKGBUILD#pkgdesc
Offline
the pkgname should be modustoolbox-bin as this is distributing precompiled binaries.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
The pkgdesc variable shouldn't contain the name of the program...
https://wiki.archlinux.org/index.php/PKGBUILD#pkgdesc
Trilby wrote:the pkgname should be modustoolbox-bin as this is distributing precompiled binaries.
Whoops. Edited my last post to resolve these issues. Thank you all again for your help (and patience).
Last edited by Brunste (2019-11-26 15:18:29)
Offline
Thanks. Nice work on this.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
hmm, does the software only get run via the desktop file executing /opt/ModusToolbox/ide_2.0/eclipse/ModusToolbox ?
If so, I would create a shellscript in /usr/bin which sets the environment variable and then executes the binary:
#!/bin/sh
export CY_TOOLS_PATHS=/opt/ModusToolbox/tools_2.0/
/opt/ModusToolbox/ide_2.0/eclipse/ModusToolbox "$@"
...
By the way, your desktop file is invalid. Per the specification: https://specifications.freedesktop.org/ … 01s06.html
The "Version" key references the version of the XDG Desktop Entry Specification which the desktop file shall be interpreted as. There's no key for the software version, as a desktop file doesn't need to know the package version. Your desktop file is definitely not using the 2.0.0 revision of the Desktop Entry Specification.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
If so, I would create a shellscript in /usr/bin which sets the environment variable and then executes the binary:
This would be my preferred approach if I was the user of this package, rather than having my global environment polluted with variables specific to this application.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline