You are not logged in.

#1 2024-07-01 21:16:58

d.ALT
Member
Registered: 2019-05-10
Posts: 943

[SOLVED] shopt, Bash Shell-Parameter-Expansion and PKGBUILD

Can someone please help me understand what am I doing wrong here? Thanks

$ LC_ALL=C printf '%s\n' $pkgver https://github.com/Robbbert/hbmame/archive/refs/tags/tag${pkgver//*(0).}.tar.gz
0.245.20
https://github.com/Robbbert/hbmame/archive/refs/tags/tag24520.tar.gz

Here's complete output

$ LC_ALL=C printf '%s\n\n' $pkgver https://github.com/Robbbert/hbmame/archive/refs/tags/tag${pkgver//*(0).}.tar.gz _ ; LC_ALL=C makepkg -cfrs || LC_ALL=C bash --version 
0.245.20

https://github.com/Robbbert/hbmame/archive/refs/tags/tag24520.tar.gz

_

==> Making package: hbmame 0.245.20-1 (Mon Jul  1 23:11:49 2024)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Installing missing dependencies...
resolving dependencies...
looking for conflicting packages...

Package (1)      New Version  Net Change

extra/rapidjson  1.1.0-6        0.62 MiB

Total Installed Size:  0.62 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                                                                                                [---------------------------------------------------------------------------------------] 100%
(1/1) checking package integrity                                                                                                              [---------------------------------------------------------------------------------------] 100%
(1/1) loading package files                                                                                                                   [---------------------------------------------------------------------------------------] 100%
(1/1) checking for file conflicts                                                                                                             [---------------------------------------------------------------------------------------] 100%
(1/1) checking available disk space                                                                                                           [---------------------------------------------------------------------------------------] 100%
:: Processing package changes...
(1/1) installing rapidjson                                                                                                                    [---------------------------------------------------------------------------------------] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
==> Retrieving sources...
  -> Downloading tag0.245.20.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404
==> ERROR: Failure while downloading https://github.com/Robbbert/hbmame/archive/refs/tags/tag0.245.20.tar.gz
    Aborting...
==> Removing installed dependencies...
checking dependencies...

Package (1)  Old Version  Net Change

rapidjson    1.1.0-6       -0.62 MiB

Total Removed Size:  0.62 MiB

:: Do you want to remove these packages? [Y/n] y
:: Processing package changes...
(1/1) removing rapidjson                                                                                                                      [---------------------------------------------------------------------------------------] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
GNU bash, version 5.2.26(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

And here's my local custom PKGBUILD:

# Maintainer: me
# Contributor: Antonio Rojas <arojas@archlinux.org>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: robb_force <robb_force@holybuffalo.net>
# Contributor: JJDaNiMoTh <jjdanimoth@gmail.com>

pkgbase=hbmame
pkgname=hbmame
pkgver=0.245.20
pkgrel=1
pkgdesc='HBMAME (HomeBrew MAME), formerly known as MisfitMAME, is a derivative of MAME 0.245, and contains various hacks and homebrews'
url='https://hbmame.1emulation.com/'
license=(GPL2)
arch=(x86_64)
makedepends=(asio
             clang
             libc++
             lld
             flac
             glm
             icoutils
             libpulse
             libutf8proc
             libxinerama
             lua
             nasm
             portaudio
             portmidi
             pugixml
             python
             qt5-base
             rapidjson
             sdl2_ttf)
source=(https://github.com/Robbbert/hbmame/archive/refs/tags/tag${pkgver//*(0).}.tar.gz
        hbmame.desktop
        hbmame.sh)
sha256sums=(SKIP
            '30f6f650d0bafe106fc8813687562e7f66375b04b3298fcb2791b51cfc1b7f22'
            'c6f5d1c0d8063a9e0b507104cc6d02b31e3caabac0fae8c729b1df9ca0cb456e')
options=(!buildflags
         !debug
         !lto
         !makeflags) # fails with makepkg defaults

prepare() {
  cd hbmame-tag${pkgver//*(0).}

  # force `genie` to use clang
  sed -i 's/gcc/clang/g; s/g++/clang++/g' 3rdparty/genie/build/gmake.linux/genie.make

  # extrating a 256c256 PNG icon
  icotool -i 6 -x src/old/hbmameui-1.ico -o ${pkgname}.png
}

build() {
  cd hbmame-tag${pkgver//*(0).}
  # https://docs.mamedev.org/initialsetup/compilingmame.html#using-libc-on-linux
  # https://wiki.archlinux.org/title/Clang#Generic_setup
  export LDFLAGS="-stdlib=libc++"
  make \
    -j16 \
    ARCHOPTS="-march=native" \
    ARCHOPTS_CXX="-march=native -stdlib=libc++" \
    ARCHOPTS_OBJCXX="-stdlib=libc++" \
    DEBUG=0 \
    DEPRECATED=0 \
    NO_SYMBOLS=1 \
    NOWERROR=1 \
    OVERRIDE_CC=clang \
    OVERRIDE_CXX=clang++ \
    REGENIE=1 \
    SYMBOLS=0 \
    TOOLS=0 \
    LTO=0 \
    TARGET=hbmame
}

package_hbmame() {
  depends=(expat
           flac
           fontconfig
           gcc-libs
           glibc
           libglvnd
           libjpeg-turbo
           libpulse
           libutf8proc
           libx11
           libxi
           lua
           portaudio
           portmidi
           pugixml
           qt5-base
           sdl2
           sdl2_ttf
           sqlite
           zlib)

  cd hbmame-tag${pkgver//*(0).}

  # Install the hbmame script
  install -Dm755 "$srcdir"/$pkgname.sh "$pkgdir"/usr/bin/$pkgname

  # Install the binaries
  install -Dm755 hbmame -t "$pkgdir"/usr/lib/hbmame

  # Install the extra bits
  install -Dm644 src/osd/modules/opengl/shader/glsl*.*h -t "$pkgdir"/usr/lib/$pkgname/shader/
  cp -ar {artwork,bgfx,plugins,language,ctrlr,hash} "$pkgdir"/usr/lib/$pkgname/

  # Include the license
  install -Dm644 docs/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE

  # documentation
  install -dm0755 "$pkgdir"/usr/share/doc
  cp -a docs "$pkgdir"/usr/share/doc/$pkgname
  rm -r "$pkgdir"/usr/share/doc/$pkgname/man
  install -Dm644 docs/man/*.6* -T "$pkgdir"/usr/share/man/man6/"$pkgname".6.gz

  # install desktop file and icon
  install -Dm644 "$srcdir"/hbmame.desktop -t "$pkgdir"/usr/share/applications
  install -Dm644 $pkgname.png -t "$pkgdir"/usr/share/icons/hicolor/256x256/apps
}

Last edited by d.ALT (2024-07-02 07:08:34)


<49,17,III,I>    Fama di loro il mondo esser non lassa;
<50,17,III,I>    misericordia e giustizia li sdegna:
<51,17,III,I>    non ragioniam di lor, ma guarda e passa.

Offline

#2 2024-07-01 21:34:13

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,084

Re: [SOLVED] shopt, Bash Shell-Parameter-Expansion and PKGBUILD

Are you running those test in bash, not some other shell?

$ temp=0.245.20
$ echo ${temp//*(0).}
0.245.20

Last edited by Scimmia (2024-07-01 21:39:07)

Offline

#3 2024-07-01 21:56:35

seth
Member
Registered: 2012-09-03
Posts: 58,698

Re: [SOLVED] shopt, Bash Shell-Parameter-Expansion and PKGBUILD

"shopt extglob"

Offline

#4 2024-07-02 05:21:57

d.ALT
Member
Registered: 2019-05-10
Posts: 943

Re: [SOLVED] shopt, Bash Shell-Parameter-Expansion and PKGBUILD

seth wrote:

"shopt extglob"

$ shopt -p | grep star
shopt -u globstar

<49,17,III,I>    Fama di loro il mondo esser non lassa;
<50,17,III,I>    misericordia e giustizia li sdegna:
<51,17,III,I>    non ragioniam di lor, ma guarda e passa.

Offline

#5 2024-07-02 05:23:56

d.ALT
Member
Registered: 2019-05-10
Posts: 943

Re: [SOLVED] shopt, Bash Shell-Parameter-Expansion and PKGBUILD

Scimmia wrote:

Are you running those test in bash, not some other shell?

$ temp=0.245.20
$ echo ${temp//*(0).}
0.245.20
$ pacman -Qs shell
local/arc-gtk-theme 20221218-2
    A flat theme with transparent elements for GTK 2,3,4 and Gnome-Shell
local/bash 5.2.026-2
    The GNU Bourne Again shell
local/bash-completion 2.14.0-2
    Programmable completion for the bash shell
local/coreutils 9.5-1
    The basic file, shell and text manipulation utilities of the GNU operating system
local/hdparm 9.65-1
    A shell utility for manipulating Linux IDE drive/driver parameters
local/kdialog 24.05.1-1 (kde-applications kde-utilities)
    A utility for displaying dialog boxes from shell scripts
local/layer-shell-qt 6.1.1-1 (plasma)
    Qt component to allow applications to make use of the Wayland wl-layer-shell protocol
local/parallel 20240622-1
    A shell tool for executing jobs in parallel
local/powerdevil 6.1.1-1 (plasma)
    Manages the power consumption settings of a Plasma Shell
local/python-shellingham 1.5.4-2
    Detect what shell the current Python executable is running in
local/zenity 4.0.1-1
    Display graphical dialog boxes from shell scripts
$ echo $SHELL
/bin/bash

<49,17,III,I>    Fama di loro il mondo esser non lassa;
<50,17,III,I>    misericordia e giustizia li sdegna:
<51,17,III,I>    non ragioniam di lor, ma guarda e passa.

Offline

#6 2024-07-02 06:14:46

seth
Member
Registered: 2012-09-03
Posts: 58,698

Re: [SOLVED] shopt, Bash Shell-Parameter-Expansion and PKGBUILD

d.ALT wrote:
seth wrote:

"shopt extglob"

$ shopt -p | grep star
shopt -u globstar

What is that meant to say/prove/test?

$ shopt -p | grep glob
FOO=0.245.20
echo "${FOO//*(0).}"
shopt -u extglob
echo "${FOO//*(0).}"

Offline

#7 2024-07-02 06:50:44

d.ALT
Member
Registered: 2019-05-10
Posts: 943

Re: [SOLVED] shopt, Bash Shell-Parameter-Expansion and PKGBUILD

seth wrote:
d.ALT wrote:
seth wrote:

"shopt extglob"

$ shopt -p | grep star
shopt -u globstar

What is that meant to say/prove/test?

Yeah, nothing... Sorry @seth ! tongue



seth wrote:
$ shopt -p | grep glob
FOO=0.245.20
echo "${FOO//*(0).}"
shopt -u extglob
echo "${FOO//*(0).}"

Here's to you:
shopt -p | grep glob:

shopt -u dotglob
shopt -s extglob
shopt -u failglob
shopt -s globasciiranges
shopt -s globskipdots
shopt -u globstar
shopt -u nocaseglob
shopt -u nullglob

$ echo "${FOO//*(0).}":

24520

$ printf '%s\n' "${FOO//*(0).}":

24520

$ printf '%s\n' ${FOO//*(0).}:

24520

$ shopt -u extglob && shopt -p | grep glob:

shopt -u dotglob
shopt -u extglob
shopt -u failglob
shopt -s globasciiranges
shopt -s globskipdots
shopt -u globstar
shopt -u nocaseglob
shopt -u nullglob

$ echo "${FOO//*(0).}":

0.245.20

$ printf '%s\n' "${FOO//*(0).}":

0.245.20

$ printf '%s\n' ${FOO//*(0).}:

0.245.20

<49,17,III,I>    Fama di loro il mondo esser non lassa;
<50,17,III,I>    misericordia e giustizia li sdegna:
<51,17,III,I>    non ragioniam di lor, ma guarda e passa.

Offline

#8 2024-07-02 06:53:10

seth
Member
Registered: 2012-09-03
Posts: 58,698

Re: [SOLVED] shopt, Bash Shell-Parameter-Expansion and PKGBUILD

I know what that does - do you understand what's going on, why scimmia didn't reproduce your desired behavior and why it's most likely failing in the pkgbuild?

Offline

#9 2024-07-02 06:55:31

d.ALT
Member
Registered: 2019-05-10
Posts: 943

Re: [SOLVED] shopt, Bash Shell-Parameter-Expansion and PKGBUILD

It's because makepkg defaults to shopt -u extglob?
If yes, where should I declare shopt -s extglob inside my PKGBUILD?

OK, added shopt -s extglob as the first uncommented line into my PKGBUILD.

Last edited by d.ALT (2024-07-02 07:06:55)


<49,17,III,I>    Fama di loro il mondo esser non lassa;
<50,17,III,I>    misericordia e giustizia li sdegna:
<51,17,III,I>    non ragioniam di lor, ma guarda e passa.

Offline

Board footer

Powered by FluxBB