diff --git a/development/bed/README b/development/bed/README new file mode 100644 index 0000000000..131653ade9 --- /dev/null +++ b/development/bed/README @@ -0,0 +1,16 @@ +bed (ncurses-based adjustable data format binary/hex editor) + +Bed is a binary editor that supports editing/viewing data in a wide +variety of formats, including ASCII, unsigned and signed integers, float, +bit-flags, bit-fields, labels, EBCDIC and time_t. Different sizes and +byte orderings are possible. Data types can be used in structures. Other +data formats, filters and procedures can be defined in plugins. + +Notes: + +- bed starts up in Ascii input mode. Press F7 to switch to "Digit-Hex" entry + mode. If this doesn't work, see the next note. + +- bed makes extensive use of Meta key combinations and the F-keys. + It's pretty sensitive to the terminal type and $TERM setting being used. + See README_SBo.txt if you have trouble with the keyboard commands. diff --git a/development/bed/README_SBo.txt b/development/bed/README_SBo.txt new file mode 100644 index 0000000000..14ca70df87 --- /dev/null +++ b/development/bed/README_SBo.txt @@ -0,0 +1,38 @@ +These terminals and TERM settings were tested and work fine: + +Terminal TERM Notes +---------------+-------+------------------------------------------------ +Linux console | linux | Default TERM setting. +rxvt | rxvt | Default TERM setting. +urxvt | rxvt | But *not* the default of "rxvt-unicode"! +xterm | xterm | Or "xterm-color". Enable "meta sends escape", + | | or use Escape as the meta key. +xcfe4-terminal | xterm | Works, but e.g. Alt-F activates the terminal's + | | own "File" menu, so you have to use Esc-F for + | | bed's "File" menu. Default TERM setting. +konsole | xterm | Default TERM setting. + +See also the TERMINALS section of bed's man page. + +Two quick things to test, the first time you start up bed: + +F7 and F8 should switch between Ascii and Digit-Hex input modes in the +status bar at the bottom of the screen. If they don't, try running bed as +'TERM=rxvt bed' or 'TERM=xterm-color bed'. If this works, you can define +it as a shell alias in e.g. ~/.bash_profile. If you're launching bed +from the KDE or XFCE start menu, you can likely force TERM from within +bed's config file (~/.bedrc or /usr/lib64/bed-3.0.0/bedrc). + +Alt-X should exit the program. If it doesn't (if it does nothing, or does +some other function like moving the cursor), try pressing Escape followed +by X. If this works, you can either use Escape instead of the Alt key for +all "Meta" commands, or else reconfigure your terminal. In xterm, this +can be done with the ctrl-leftclick menu (enable "Meta Sends Escape"), +or set xterm's metaSendsEscape and/or altSendsEscape resources to 'true' +in ~/.Xdefaults. + +It should be possible to define a set of keybinds for bed that work with +any terminal and TERM, with "bed -k ~/.bedrc". No, I don't know what a +"stab" key is, either (just pick an otherwise-unused keystroke for it). +I also don't know why it asks you to press the various keys in a seemingly +random order... but it does work. diff --git a/development/bed/bed-binary-editor.desktop b/development/bed/bed-binary-editor.desktop new file mode 100644 index 0000000000..cd0052e8cd --- /dev/null +++ b/development/bed/bed-binary-editor.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Name=Bed - Binary Editor +Name[nl]=Bed - Binaire Editor +GenericName=Binary Editor +GenericName[nl]=Binaire Editor +Comment=Adjustable dataformat: ascii,integer,unsigned,float,struct +Comment[nl]=Instelbaar datatype: ascii,integer,unsigned,float,struct +Exec=bed %U +Terminal=true +Type=Application +Categories=Development; +StartupNotify=true diff --git a/development/bed/bed.SlackBuild b/development/bed/bed.SlackBuild new file mode 100644 index 0000000000..37bae15312 --- /dev/null +++ b/development/bed/bed.SlackBuild @@ -0,0 +1,157 @@ +#!/bin/sh + +# Slackware build script for bed + +# Written by B. Watson (yalhcru@gmail.com) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +PRGNAM=bed +VERSION=${VERSION:-3.0.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.src.tar.xz +cd $PRGNAM-$VERSION + +# Ships as a broken symlink... gets recreated during the build anyway. +rm -f ./plugins/mainprocedures.h + +# The permissions are a bit wonky (a few executable C source files) but +# no harm done. +chown -R root:root . +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ + +# I found the startup message confusing, it says "Alt-X to open menu", +# where X is used in the algebra sense (to mean "whatever"). I kept +# expecting a literal Alt-X to mean "open menu", when it really means +# "exit". So: +sed -i '/Press F1 in menu/s/X/[x]/g' plugins/examples/helpf1.cc + +# Not sure the --without-x does anything, but it doesn't hurt either. +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --without-x \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --docdir=/usr/doc/$PRGNAM-$VERSION \ + --build=$ARCH-slackware-linux + +# Hardcoded -O3 here: +sed -i "s/-O3/$SLKCFLAGS/g" plugins/examples/Makefile + +# Source ships pregenerated versions of these that were made on a +# cygwin system. They break the build. +rm -f src/dataproc.h src/dataprocer.h + +# The Makefile hates -jN where N>1. + +# The TOBUILD* stuff below is because we said +# "--build=$ARCH-slackware-linux" as usual in the ./configure +# above, and bed is expecting there to be an actual compiler called +# $ARCH-slackware-linux-cc in $PATH, which there ain't. If we were +# cross-compiling, this would have to be solved some other way. + +# Regenerate the 2 headers removed above, plus one more that fails +# to be generated for whatever reason. +make -j1 -C src TOBUILDCC=gcc TOBUILDCXX=g++ OPTIM="$SLKCFLAGS" \ + dataproc.h dataprocer.h helptext.h + +# *Now* we can compile for real. +make -j1 TOBUILDCC=gcc TOBUILDCXX=g++ OPTIM="$SLKCFLAGS" + +# No 'install-strip' target, but the binary's installed stripped +# and the man page is gzipped already. +make -j1 install DESTDIR=$PKG + +# Lot of stuff below uses this +PKGBEDLIB=$PKG/usr/lib$LIBDIRSUFFIX/$PRGNAM-$VERSION + +# Replace .desktop file with cleaned-up version that passes +# desktop-file-validate. There's no icon defined in the file, nor shipped +# with bed, so I'm leaving that as-is. The desktop menu specification +# doesn't have a HexEditor or even a generic Editor category (which IMO +# is a symptom of how broken the thinking behind the specification is), +# so I had to pick between the generic System and slightly-less-generic +# Development categories... +DT=bed-binary-editor.desktop +cat $CWD/$DT > $PKG/usr/share/applications/$DT + +# The rxvt stuff (rxvt.plug) doesn't get built by this script. The build +# process is too horrendous and baroque for me to spend more time trying +# to understand why. The default config file tries to load rxvt.plug and +# shows a scary but harmless "rxvt.plug: cannot open shared object file" +# error on startup, so I'm just going to disable it in the config. + +# In case you're wondering, the editor's fully functional without the +# plugin. What it actually does is allows you to adjust the terminal +# bed is running in (the font size, set reverse video, and disable the +# scrollbar) from within bed. Most (all?) terminals already supply their +# own ways to do these things, so this is really extra fluff. +RC=$PKGBEDLIB/bedrc +sed -e 's/^ *plugin *rxvt\.plug/#&/' \ + -e 's/^ *menuitem *8/#&/' \ + $RC > $RC.new +rm -f $RC + +# The magic stuff for file. doinst.sh handles the rest. +mkdir -p $PKG/etc/file/magic +mv $PKGBEDLIB/bedmagic $PKG/etc/file/magic +rm -f $PKGBEDLIB/bedmagic.short $PKGBEDLIB/addmagic + +# Don't want this (use removepkg instead): +rm -f $PKGBEDLIB/uninstallbed.sh + +# There's still some cruft in $PKGBEDLIB (e.g. sources for the plugins), +# but it's stuff that could be considered documentation so I'll leave it. + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +for i in LICENSE README; do + ln -s ../../lib$LIBDIRSUFFIX/$PRGNAM-$VERSION/$i $PKG/usr/doc/$PRGNAM-$VERSION +done +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n -p $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/development/bed/bed.info b/development/bed/bed.info new file mode 100644 index 0000000000..0c5b414a16 --- /dev/null +++ b/development/bed/bed.info @@ -0,0 +1,10 @@ +PRGNAM="bed" +VERSION="3.0.0" +HOMEPAGE="https://www.dse.nl/~bed/" +DOWNLOAD="https://www.dse.nl/~bed/download/bed-3.0.0.src.tar.xz" +MD5SUM="cd2f49434d673bd4f124b6cb1d1a1dbd" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="B. Watson" +EMAIL="yalhcru@gmail.com" diff --git a/development/bed/doinst.sh b/development/bed/doinst.sh new file mode 100644 index 0000000000..765706c116 --- /dev/null +++ b/development/bed/doinst.sh @@ -0,0 +1,19 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + rm $NEW + fi +} + +config usr/share/bed/bedrc.new + +if [ -x /usr/bin/update-desktop-database ]; then + /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 +fi + +if [ -x etc/file/recompile_magic.mgc.sh ]; then + etc/file/recompile_magic.mgc.sh +fi diff --git a/development/bed/slack-desc b/development/bed/slack-desc new file mode 100644 index 0000000000..a286353d05 --- /dev/null +++ b/development/bed/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +bed: bed (ncurses-based adjustable data format binary/hex editor) +bed: +bed: Bed is a binary editor that supports editing/viewing data in a wide +bed: variety of formats, including ASCII, unsigned and signed integers, +bed: float, bit-flags, bit-fields, labels, EBCDIC and time_t. Different +bed: sizes and byte orderings are possible. Data types can be used in +bed: structures. Other data formats, filters and procedures can be defined +bed: in plugins. +bed: +bed: +bed: