bless.SlackBuild 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. #!/bin/bash
  2. # Slackware build script for bless
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20211210 bkw: BUILD=2
  6. # - add patch from Debian's 0.6.0-7 to fix saving preferences.
  7. # - don't include useless skeleton of bless-manual.omf in package.
  8. # - don't use gconf from help_script.sh, it broke. just open the
  9. # HTML help with xdg-open.
  10. # - fix the 'select layout' dialog, now you can see & load system layouts.
  11. # - new-style icon (singular, 48x48).
  12. cd $(dirname $0) ; CWD=$(pwd)
  13. PRGNAM=bless
  14. VERSION=${VERSION:-0.6.0}
  15. BUILD=${BUILD:-2}
  16. TAG=${TAG:-_SBo}
  17. PKGTYPE=${PKGTYPE:-tgz}
  18. # Compiled .net code is "anycpu" by default.
  19. # I see no reason to use lib64 for this. It would mean having separate
  20. # 32-bit and 64-bit packages, even though the actual object code is
  21. # noarch. Also, no CFLAGS because, no C... since I'm not a mono/C#
  22. # expert, I dunno what the equivalent optimization flags should be
  23. # (or if they even exist) so we'll go with whatever upstream does.
  24. ARCH=noarch
  25. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  26. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  27. exit 0
  28. fi
  29. TMP=${TMP:-/tmp/SBo}
  30. PKG=$TMP/package-$PRGNAM
  31. OUTPUT=${OUTPUT:-/tmp}
  32. set -e
  33. rm -rf $PKG
  34. mkdir -p $TMP $PKG $OUTPUT
  35. cd $TMP
  36. rm -rf $PRGNAM-$VERSION
  37. tar xvf $CWD/${PRGNAM}_$VERSION.orig.tar.gz
  38. cd $PRGNAM-$VERSION
  39. chown -R root:root .
  40. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  41. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  42. # Begin rant. FWIW, I'm not very impressed with bless:
  43. # - It has show-stopper bugs that were left in place when the maintainer
  44. # abandoned it a few years ago (others have fixed the worst of them
  45. # by now, patches included here).
  46. # - It starts up in Insert mode which definitely violates the principle
  47. # of least surprise (in normal hex editors, overwrite is generally the
  48. # default and often only mode). This is so annoying that I patched it.
  49. # Even in overwrite mode, it'll let you append bytes to the end of
  50. # the file, which a hex editor shouldn't do in its default mode.
  51. # - It ships with 3 .layout files that get installed in /usr/share, but
  52. # the layout dialog is broken: you can't choose between the
  53. # "system" layouts... now I've fixed this, at least.
  54. # - Finally, and maybe this is just my own personal bias, I don't see an
  55. # obvious way to change the white background to black (if the .layout
  56. # files are capable of it, great, but I tried really hard to get them
  57. # to work and they don't seem to behave the way the docs say they do).
  58. # This means I won't be using this application very much, as it hurts
  59. # my eyes to look at it for more than a few minutes.
  60. # If it's so awful, why am I writing a SlackBuild for it? Because
  61. # it's a GUI hex editor that (a) uses GTK, (b) doesn't suck quite
  62. # as hard as ghex, and (c) doesn't require KDE and its horde of
  63. # daemons. Someone is going to be glad it's here. People who grew up
  64. # using GUIs are going to prefer this to a textmode app.
  65. # Here endeth the rant.
  66. # Patch from Debian. Might not be needed with newer versions of mono,
  67. # but no harm done.
  68. patch -p1 < $CWD/patches/force_gtk_action_namespace.patch
  69. # Patch from dead gna.org site:
  70. # http://web.archive.org/web/20170205194531/http://gna.org/bugs/?14878
  71. # Fixes "not enough space" error when trying to save.
  72. patch -p1 < $CWD/patches/fix_save.patch
  73. # Similar-named patch from Debian. This one fixes saving preferences.
  74. patch -p1 < $CWD/patches/fix_save_behaviour.patch
  75. # Patch from: https://bugs.launchpad.net/ubuntu/+source/bless/+bug/1622951
  76. # Fixes broken preferences saving.
  77. patch -p1 < $CWD/patches/fixxmltextwriter.patch
  78. # Make bless act like all other hex editors on the planet by NOT starting
  79. # up in Insert mode. I wouldn't have patched this, except that bless
  80. # doesn't auto-save the Insert/Overwrite state across sessions. You can
  81. # set the default via Edit/Preferences, but it doesn't remember the last
  82. # state if you just press Insert to toggle it.
  83. patch -p1 < $CWD/patches/default_overwrite.patch
  84. patch -p1 < $CWD/patches/disambiguate-system.range-and-gtk.range.patch
  85. # 20211210 bkw: make it look in the right place for its own layout files.
  86. sed -i '/FileResourcePath\.GetDataPath("data")/s,"data",".",' \
  87. src/gui/dialogs/LayoutSelectionDialog.cs
  88. # Grr. The configure script doesn't allow setting CS or MCS or CSC or
  89. # anything to override the compiler (like normal stuff does with CC).
  90. # FFS, it's even hardcoded in C# code...
  91. sed -i 's,gmcs,mcs,g' configure builder/ModuleBuilder.cs
  92. ./configure \
  93. --without-scrollkeeper \
  94. --prefix=/usr \
  95. --libdir=/usr/lib \
  96. --sysconfdir=/etc \
  97. --localstatedir=/var \
  98. --mandir=/usr/man \
  99. --docdir=/usr/doc/$PRGNAM-$VERSION
  100. # GRR. Even with --without-scrollkeeper we have to fake it out. I
  101. # could look into using rarian, but I'm not sure what good it would
  102. # do: the .xml and .html help files are already installed in the right
  103. # places, and help_script.sh knows how to display them when you click
  104. # Help/Contents or press F1.
  105. cp doc/user/bless-manual.omf.in doc/user/bless-manual.omf
  106. make
  107. make install DESTDIR=$PKG
  108. # --docdir is ignored.
  109. mkdir -p $PKG/usr/doc/
  110. mv $PKG/usr/share/doc/$PRGNAM $PKG/usr/doc/$PRGNAM-$VERSION
  111. rm -rf $PKG/usr/share/doc $PKG/usr/share/omf
  112. # The help script needed help.
  113. PKGHELP=$PKG/usr/share/$PRGNAM/help_script.sh
  114. sed "s/@VERSION@/$VERSION/g" $CWD/help_script.sh > $PKGHELP
  115. chmod 755 $PKGHELP
  116. # Man page from Debian. Not much to it, but not much was needed.
  117. mkdir -p $PKG/usr/man/man1
  118. gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  119. HICOLOR=$PKG/usr/share/icons/hicolor/48x48/apps
  120. PIXMAPS=$PKG/usr/share/pixmaps
  121. rm -f $PIXMAPS/*
  122. mkdir -p $HICOLOR
  123. mv $PKG/usr/share/$PRGNAM/bless-48x48.png $HICOLOR/$PRGNAM.png
  124. ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/$PRGNAM/bless-48x48.png
  125. ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PIXMAPS/$PRGNAM.png
  126. sed -i '/Icon=/s,=.*,=bless,' $PKG/usr/share/applications/$PRGNAM.desktop
  127. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  128. mkdir -p $PKG/install
  129. cat $CWD/slack-desc > $PKG/install/slack-desc
  130. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  131. cd $PKG
  132. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE