bless.SlackBuild 6.3 KB

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