Package Details: powder-toy 94.1-1

Git Clone URL: https://aur.archlinux.org/powder-toy.git (read-only)
Package Base: powder-toy
Description: Desktop version of the classic falling sand physics sandbox, simulates air pressure, velocity & heat!
Upstream URL: http://powdertoy.co.uk/
Licenses: GPL3
Submitter: farseerfc
Maintainer: farseerfc (lilac)
Last Packager: lilac
Votes: 29
Popularity: 1.948632
First Submitted: 2015-08-10 10:26
Last Updated: 2019-03-01 09:46

Latest Comments

dmitmel commented on 2019-10-06 06:45

Hi! I've rewritten the PKGBUILD. This is what I've done:

  1. Removed obsolete code
    • NATIVE_OPTIMIZATIONS - SConscrpit works fine if -march=native is present in /etc/makepkg.conf
    • scons options --save-version, --minor-version, --build-number - they're already included in the upstream src/Config.h
  2. Added a variable ($_lua) to choose the Lua version.
  3. Used as much metafiles from upstream as possible
    • .desktop files were extracted from the installation routine (Client::DoInstallation() in src/client/Client.cpp), although had to be modified a bit so I moved them in the AUR package directory
    • different sizes of application icons are now installed from the upstream
    • also I extract document icons from the .icns file at build time and install them as well
    • misc files like MIME data files and AppStream appdata are installed too
  4. Added a wrapper script which runs Powder Toy inside a data directory located at $XDG_DATA_HOME/powder-toy
  5. Rewritten the code according to the modern ArchWiki recommendations

Here is the patch:

diff --git a/.SRCINFO b/.SRCINFO
index c796747..14d5290 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,24 +1,33 @@
 pkgbase = powder-toy
    pkgdesc = Desktop version of the classic falling sand physics sandbox, simulates air pressure, velocity & heat!
    pkgver = 94.1
-   pkgrel = 1
+   pkgrel = 2
    url = http://powdertoy.co.uk/
-   arch = i686
    arch = x86_64
+   arch = i686
    license = GPL3
-   makedepends = python2
    makedepends = scons
+   makedepends = libicns
    depends = sdl2
-   depends = lua52
+   depends = luajit
    depends = fftw
    depends = bzip2
    depends = zlib
-   source = powder-toy-94.1-340.tar.gz::http://github.com/ThePowderToy/The-Powder-Toy/archive/v94.1.tar.gz
+   depends = desktop-file-utils
+   depends = hicolor-icon-theme
+   depends = shared-mime-info
+   source = powder-toy-94.1.tar.gz::http://github.com/ThePowderToy/The-Powder-Toy/archive/v94.1.tar.gz
+   source = powder-toy.patch
+   source = powder-toy.sh
    source = powder-toy.desktop
-   source = powder-toy.png
-   md5sums = 7e55a347df49c5df23dc977fb719c208
-   md5sums = e223e1d622f11c03af26ba3e60c7d500
-   md5sums = bb40bf9c2fa3982e2872b5d32de3b006
+   source = powder-toy-open.desktop
+   source = powder-toy-ptsave.desktop
+   sha256sums = 9770c0732c97e4e89a1e53330c969e9675595f78e6673c519c3724d6df591e72
+   sha256sums = fc3ce245ce37dea006aa84e93ab9df7dbe398a5dd6669f2cd5f1638691c8b84e
+   sha256sums = 694cf4c9cb85b47d9b777b9a9b23ca44b8ce3c9539515eb495ee2a056e3f9756
+   sha256sums = 265f530be7597fcc7bbaf2690fd517fe4f8f18372c808a90ddef49a604c8d455
+   sha256sums = 398f6d068dd37e12989f4132ea5966886b14036bac07a589991b283d242b4ca5
+   sha256sums = fcbf035d286d805dced55f147d649aa0bc74d3be873d5430de92d175d9f59431

 pkgname = powder-toy

diff --git a/PKGBUILD b/PKGBUILD
index b389213..d5f7aff 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,77 +1,94 @@
 # Maintainer: farseerfc <farseerfc@archlinuxcn.org>
-# Contributor: refujee     <gmail.com: refujee>
-# Contributor: sausageandeggs  <archlinux.us: sausageandeggs>
-# Contributor: Jesse Jaara <gmail.com: jesse.jaara>
-
-# Set to 'y' if you want native optimizations (-march=native)
-# based on your hardware. Enabled automatically if -march
-# is set to native in makepkg.conf.
-NATIVE_OPTIMIZATIONS=n
-
+# Contributor: Dmytro Meleshko <dmytro.meleshko@gmail.com>
+# Contributor: refujee <gmail.com: refujee>
+# Contributor: sausageandeggs <archlinux.us: sausageandeggs>
+# Contributor: Jesse Jaara <gmail.com: jesse.jaara>

+# Select version of Lua. Possible values are luajit, lua51, lua52 and an empty
+# string to disable Lua support. luajit is used in the official builds.
+_lua=luajit

 pkgname=powder-toy
-#pkgver=${_sver}.${_mver}
 pkgver=94.1
-_sver=${pkgver/.*/}
-_mver=${pkgver/*./}
-_build=340
-pkgrel=1
+pkgrel=2
 pkgdesc="Desktop version of the classic falling sand physics sandbox, simulates air pressure, velocity & heat!"
-arch=(i686 x86_64)
-depends=('sdl2' 'lua52' 'fftw' 'bzip2' 'zlib')
-makedepends=('python2' 'scons')
+arch=(x86_64 i686)
+depends=('sdl2' $_lua 'fftw' 'bzip2' 'zlib' 'desktop-file-utils' 'hicolor-icon-theme' 'shared-mime-info')
+makedepends=('scons' 'libicns')
 url="http://powdertoy.co.uk/"
 license=('GPL3')
-source=("${pkgname}-${pkgver}-${_build}.tar.gz::http://github.com/ThePowderToy/The-Powder-Toy/archive/v${pkgver}.tar.gz"
-   ${pkgname}.desktop ${pkgname}.png)
+source=("${pkgname}-${pkgver}.tar.gz::http://github.com/ThePowderToy/The-Powder-Toy/archive/v${pkgver}.tar.gz"
+        ${pkgname}.patch
+        ${pkgname}.sh
+        ${pkgname}.desktop
+        ${pkgname}-open.desktop
+        ${pkgname}-ptsave.desktop)
+sha256sums=('9770c0732c97e4e89a1e53330c969e9675595f78e6673c519c3724d6df591e72'
+            'fc3ce245ce37dea006aa84e93ab9df7dbe398a5dd6669f2cd5f1638691c8b84e'
+            '694cf4c9cb85b47d9b777b9a9b23ca44b8ce3c9539515eb495ee2a056e3f9756'
+            '265f530be7597fcc7bbaf2690fd517fe4f8f18372c808a90ddef49a604c8d455'
+            '398f6d068dd37e12989f4132ea5966886b14036bac07a589991b283d242b4ca5'
+            'fcbf035d286d805dced55f147d649aa0bc74d3be873d5430de92d175d9f59431')

 prepare() {
-  cd "${srcdir}/The-Powder-Toy-${pkgver}"
-
-  #Disable the updates. I cant get the buildsystem to not compile a beta version.
-  #Also I do not know the logic behind the generated snapshotids.
-  sed 's|//#define I|#define I|' -i src/Config.h
-
-  sed "s|Version=.*|Version=$pkgver|" -i ../${pkgname}.desktop
+  cd "The-Powder-Toy-${pkgver}"
+  patch --forward --strip=1 --input="${srcdir}/${pkgname}.patch"
 }

 build() {
-  unset _xarch _ssever _native
-  cd "${srcdir}/The-Powder-Toy-${pkgver}"
+  cd "The-Powder-Toy-${pkgver}"

-  if $(grep -q 'pni' -i /proc/cpuinfo); then
-    _ssever="sse3"
-  elif $(grep -q sse2 -i /proc/cpuinfo); then
-    _ssever="sse2"
-  elif $(grep -q sse -i /proc/cpuinfo); then
-    _ssever="sse"
-  else
-    _ssever="no-sse"
-  fi
+  # extract document icons from macOS .icns files
+  cd "$resources"
+  icns2png -x resources/document.icns

-#  if [ NATIVE_OPTIMIZATIONS == "y"  ] || $(echo ${CXXFLAGS} | grep -q -- "-march=native"); then
-#    _native="--native"
-#  fi
+  local extra_flags=()

-  if [ "${CARCH}" == "x86_64" ]; then
-    _xarch="--64bit"
+  case "$CARCH" in
+    x86_64) extra_flags+=(--64bit) ;;
+      i686) extra_flags+=(--32bit) ;;
+  esac
+
+  if   grep -q -i pni  /proc/cpuinfo; then
+    extra_flags+=(--sse3)
+  elif grep -q -i sse2 /proc/cpuinfo; then
+    extra_flags+=(--sse2)
+  elif grep -q -i sse  /proc/cpuinfo; then
+    extra_flags+=(--sse)
+  else
+    extra_flags+=(--no-sse)
   fi

-  msg2 "building powder with options with following extra flags ${_xarch} --${_ssever} ${_native}"
-  scons --lin ${_xarch} --release --${_ssever} ${_native} --save-version=${_sver} \
-   --minor-version=${_mver} --build-number=${_build} ${MAKEFLAGS} \
-    --lua52
+  case "$_lua" in
+    luajit) extra_flags+=(--luajit) ;;
+     lua51)                         ;; # lua51 support is enabled by default
+     lua52) extra_flags+=(--lua52)  ;;
+        "") extra_flags+=(--nolua)  ;;
+  esac

-  mv build/{powder*,binary}
+  msg2 "building ${pkgname} with the following extra flags: ${extra_flags[*]}"
+  scons --lin --release --output="${pkgname}" ${MAKEFLAGS} "${extra_flags[@]}"
 }

 package() {
-  install -Dm 755 "${srcdir}/The-Powder-Toy-${pkgver}/build/binary" "${pkgdir}/usr/bin/powder-toy"
-  install -Dm 644 "${srcdir}/${pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop"
-  install -Dm 644 "${srcdir}/${pkgname}.png" "${pkgdir}/usr/share/pixmaps/${pkgname}.png"
-}
+  install -Dm755 "${pkgname}.sh" "${pkgdir}/usr/bin/${pkgname}"
+  install -Dm644 "${pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop"
+  install -Dm644 "${pkgname}-open.desktop" "${pkgdir}/usr/share/applications/${pkgname}-open.desktop"
+  install -Dm644 "${pkgname}-ptsave.desktop" "${pkgdir}/usr/share/applications/${pkgname}-ptsave.desktop"

-md5sums=('7e55a347df49c5df23dc977fb719c208'
-         'e223e1d622f11c03af26ba3e60c7d500'
-         'bb40bf9c2fa3982e2872b5d32de3b006')
+  cd "The-Powder-Toy-${pkgver}"
+
+  install -Dm755 "build/${pkgname}" "${pkgdir}/usr/lib/${pkgname}/${pkgname}"
+  install -Dm644 "resources/powdertoy-save.xml" "${pkgdir}/usr/share/mime/packages/${pkgname}-save.xml"
+  install -Dm644 "resources/powder.appdata.xml" "${pkgdir}/usr/share/metainfo/${pkgname}.appdata.xml"
+
+  local icon_size
+  for icon_size in 16 24 32 48 128 256; do
+    install -Dm644 "resources/icon/powder-${icon_size}.png" \
+      "${pkgdir}/usr/share/icons/hicolor/${icon_size}x${icon_size}/apps/${pkgname}.png"
+  done
+  for icon_size in 16 32 128 256 512; do
+    install -Dm644 "resources/document_${icon_size}x${icon_size}x32.png" \
+      "${pkgdir}/usr/share/icons/hicolor/${icon_size}x${icon_size}/mimetypes/application-vnd.${pkgname}.save.png"
+  done
+}
diff --git a/powder-toy-open.desktop b/powder-toy-open.desktop
new file mode 100644
index 0000000..715a38e
--- /dev/null
+++ b/powder-toy-open.desktop
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Type=Application
+Version=1.0
+Name=Powder Toy
+NoDisplay=true
+Comment=Physics sandbox game
+Icon=powder-toy
+Exec=powder-toy open %f
+Terminal=false
+MimeType=application/vnd.powder-toy.save;
+Categories=Game;Simulation;
+StartupNotify=false
diff --git a/powder-toy-ptsave.desktop b/powder-toy-ptsave.desktop
new file mode 100644
index 0000000..bf90bb5
--- /dev/null
+++ b/powder-toy-ptsave.desktop
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Type=Application
+Version=1.0
+Name=Powder Toy
+NoDisplay=true
+Comment=Physics sandbox game
+Icon=powder-toy
+Exec=powder-toy ptsave %u
+Terminal=false
+MimeType=x-scheme-handler/ptsave;
+Categories=Game;Simulation;
+StartupNotify=false
diff --git a/powder-toy.desktop b/powder-toy.desktop
index 0350a06..5aa0180 100644
--- a/powder-toy.desktop
+++ b/powder-toy.desktop
@@ -1,12 +1,10 @@
-
 [Desktop Entry]
 Type=Application
-Version=94.1
-Encoding=UTF-8
+Version=1.0
 Name=Powder Toy
-Comment=A physics simulation game.
-Exec=powder-toy
+Comment=Physics sandbox game
 Icon=powder-toy
+Exec=powder-toy
 Terminal=false
+Categories=Game;Simulation;
 StartupNotify=false
-Categories=Game;
diff --git a/powder-toy.patch b/powder-toy.patch
new file mode 100644
index 0000000..7ccb251
--- /dev/null
+++ b/powder-toy.patch
@@ -0,0 +1,35 @@
+diff --unified --recursive --text --color The-Powder-Toy-94.1.orig/resources/powder.appdata.xml The-Powder-Toy-94.1/resources/powder.appdata.xml
+--- The-Powder-Toy-94.1.orig/resources/powder.appdata.xml  2019-02-21 07:23:45.000000000 +0200
++++ The-Powder-Toy-94.1/resources/powder.appdata.xml   2019-10-06 00:21:18.550019454 +0300
+@@ -1,6 +1,6 @@
+ <?xml version="1.0" encoding="UTF-8"?>
+ <component type="desktop">
+-  <id>powder.desktop</id>
++  <id>powder-toy.desktop</id>
+   <metadata_license>CC0-1.0</metadata_license>
+   <project_license>GPL-3.0</project_license>
+   <name>Powder Toy</name>
+diff --unified --recursive --text --color The-Powder-Toy-94.1.orig/resources/powdertoy-save.xml The-Powder-Toy-94.1/resources/powdertoy-save.xml
+--- The-Powder-Toy-94.1.orig/resources/powdertoy-save.xml  2019-02-21 07:23:45.000000000 +0200
++++ The-Powder-Toy-94.1/resources/powdertoy-save.xml   2019-10-06 00:21:51.080019592 +0300
+@@ -1,6 +1,6 @@
+ <?xml version="1.0"?>
+ <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
+-  <mime-type type="application/vnd.powdertoy.save">
++  <mime-type type="application/vnd.powder-toy.save">
+       <comment>Powder Toy save</comment>
+       <glob pattern="*.cps"/>
+       <glob pattern="*.stm"/>
+diff --unified --recursive --text --color The-Powder-Toy-94.1.orig/src/Config.h The-Powder-Toy-94.1/src/Config.h
+--- The-Powder-Toy-94.1.orig/src/Config.h  2019-02-21 07:23:45.000000000 +0200
++++ The-Powder-Toy-94.1/src/Config.h   2019-10-06 01:33:00.610003177 +0300
+@@ -40,7 +40,8 @@
+ #endif
+ //VersionInfoEnd
+
+-//#define IGNORE_UPDATES //uncomment this for mods, to not get any update notifications
++#define IGNORE_UPDATES
++#define NO_INSTALL_CHECK
+
+ #if !(defined(MACOSX) && defined(DEBUG))
+ #define HIGH_QUALITY_RESAMPLE         //High quality image resampling, slower but much higher quality than my terribad linear interpolation
diff --git a/powder-toy.png b/powder-toy.png
deleted file mode 100644
index 02ebd59..0000000
Binary files a/powder-toy.png and /dev/null differ
diff --git a/powder-toy.sh b/powder-toy.sh
new file mode 100755
index 0000000..50f4c68
--- /dev/null
+++ b/powder-toy.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+pkgname=powder-toy
+data_home="${XDG_DATA_HOME:-${HOME}/.local/share}/${pkgname}"
+mkdir -p "${data_home}" && cd "${data_home}" || exit 1
+exec "/usr/lib/${pkgname}/${pkgname}" "$@"

Also, I'm not sure if I have to post this kind of comment here. Should I send patches to maintainer's email?

jadenPete commented on 2019-02-28 04:26

Please change "Exec=/usr/bin/powder-toy" to "Exec=powder-toy"

It doesn't allow for wrapper scripts

MarcinWieczorek commented on 2018-07-26 12:09

Hello, please rename the tarball so it doesn't cause conflicts for common source directories. Thank you.

eisterman commented on 2018-04-23 09:16

Change PKGBUILD version to 93.3 Change the first MD5 to 16c5751f9b9c7a6283f423365fe73b1a (The-Powder-Toy-93.3.tar.gz)

Do this changes in your PKGBUILD for updating the software

sudoBash418 commented on 2017-10-10 03:19

Seems to be an upstream issue; downgrading scons from 3.0.0 to 2.5.1 fixed it.
I'll file a bug report upstream.
EDIT: it's now fixed upstream.

sudoBash418 commented on 2017-10-10 03:05

When building (with pacaur), I get a build failure:

-> building powder with options with following extra flags --64bit --sse3
scons: Reading SConscript files ...
File "/root/.cache/pacaur/powder-toy/src/The-Powder-Toy-92.0.331/SConstruct", line 12

print "couldn't remove .sconf_temp/"

^

SyntaxError: Missing parentheses in call to 'print'

farseerfc commented on 2017-07-24 21:48

@Alfred456654 thanks! I have updated the PKGBUILD to the official repo.

Alfred456654 commented on 2017-07-24 12:22

Hi!

I just noticed that the repo in the PKGBUILD isn't the "official" repo:
The one in the PKGBUILD is https://github.com/FacialTurd/The-Powder-Toy.
The official one is https://github.com/ThePowderToy/The-Powder-Toy.

In the PKGBUILD, it changes several things:
- the source URL on line 25;
- the name of the archive on lines 29, 39 and 68 (s/mod1-//g);
- the md5 sum of the archive on line 73;
- the version number:
* _sver=92
* _mver=0
* _build=331