|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +alias cp='busybox cp -a' |
| 4 | +alias cut='busybox cut' |
| 5 | +alias date='busybox date' |
| 6 | +alias du='busybox du' |
| 7 | +alias mkdir='busybox mkdir -p' |
| 8 | +alias rm='busybox rm -rf' |
| 9 | +alias sed='busybox sed' |
| 10 | +alias tar='busybox tar' |
| 11 | + |
| 12 | +PROGRAM="fluff" |
| 13 | + |
| 14 | +STARTDIR="$PWD" |
| 15 | +PACKAGEDIR="$STARTDIR/package" |
| 16 | +PREFIX="/usr/local" |
| 17 | +DESTDIR="$PACKAGEDIR/$PREFIX" |
| 18 | +SRCDIR="src" |
| 19 | + |
| 20 | +OPTIMIZE="-Os -flto" |
| 21 | +SYMBOLS="-g" |
| 22 | + |
| 23 | +TOOLCHAIN="compiletc sstrip submitqc" |
| 24 | +BUILD_DEPS="fltk-1.3-dev" |
| 25 | +PACKAGE_DEPS="fltk-1.3" |
| 26 | + |
| 27 | +GDEBUG="No" |
| 28 | +# Uncomment the next line to compile a version that can be run under gdb. |
| 29 | +#GDEBUG="Debug" |
| 30 | + |
| 31 | +if [ "$GDEBUG" == "Debug" ] |
| 32 | +then |
| 33 | +# -flto gets removed because it interferes with gdb being able to display |
| 34 | +# code listings. |
| 35 | + OPTIMIZE="-O0 -ggdb" |
| 36 | +fi |
| 37 | + |
| 38 | + |
| 39 | +PROCESSOR_TYPE=`uname -m` |
| 40 | +echo "$PROCESSOR_TYPE detected." |
| 41 | + |
| 42 | +case "$PROCESSOR_TYPE" in |
| 43 | + i686) |
| 44 | + CFLAGS="-fuse-linker-plugin -march=i486 -mtune=i686 $OPTIMIZE $SYMBOLS -pipe -Wall -Wextra -fno-plt" |
| 45 | + CXXFLAGS="-fuse-linker-plugin -march=i486 -mtune=i686 $OPTIMIZE $SYMBOLS -pipe -Wall -Wextra -fno-exceptions -fno-rtti" |
| 46 | + LDFLAGS="-Wl,-T/usr/local/lib/ldscripts/elf_i386.xbn" |
| 47 | + ;; |
| 48 | + |
| 49 | + x86_64) |
| 50 | + CFLAGS="-fuse-linker-plugin -mtune=generic $OPTIMIZE $SYMBOLS -pipe -Wall -Wextra -fno-plt" |
| 51 | + CXXFLAGS="-fuse-linker-plugin -mtune=generic $OPTIMIZE $SYMBOLS -pipe -Wall -Wextra -fno-exceptions -fno-rtti" |
| 52 | + LDFLAGS="-Wl,-T/usr/local/lib/ldscripts/elf_x86_64.xbn" |
| 53 | + ;; |
| 54 | + |
| 55 | + armv*) |
| 56 | + CFLAGS="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp $OPTIMIZE $SYMBOLS -pipe -Wall -Wextra" |
| 57 | + CXXFLAGS="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp $OPTIMIZE $SYMBOLS -pipe -Wall -Wextra -fno-exceptions -fno-rtti" |
| 58 | + LDFLAGS="-Wl,-O1" |
| 59 | + ;; |
| 60 | + |
| 61 | + aarch64) |
| 62 | + CFLAGS="-march=armv8-a+crc -mtune=cortex-a72 $OPTIMIZE $SYMBOLS -pipe -Wall -Wextra" |
| 63 | + CXXFLAGS="-march=armv8-a+crc -mtune=cortex-a72 $OPTIMIZE $SYMBOLS -pipe -Wall -Wextra -fno-exceptions -fno-rtti" |
| 64 | + LDFLAGS="-Wl,-O1" |
| 65 | + ;; |
| 66 | + |
| 67 | + *) |
| 68 | + echo "$PROCESSOR_TYPE: Unknown processor type. Please add an entry for it in this script." |
| 69 | + exit |
| 70 | + ;; |
| 71 | +esac |
| 72 | + |
| 73 | +# Download packages required for compiling, filter out success messages. |
| 74 | +tce-load -w "$TOOLCHAIN $BUILD_DEPS" 2>&1 | grep -v "already downloaded" |
| 75 | + |
| 76 | +# Install packages required for compiling, filter out success messages. |
| 77 | +tce-load -i "$TOOLCHAIN $BUILD_DEPS" 2>&1 | grep -v "already installed" |
| 78 | + |
| 79 | +cd "$STARTDIR/$SRCDIR" |
| 80 | + |
| 81 | +# Build "$PROGRAM" |
| 82 | +#gcc -march=i486 -mtune=i686 "$OPTIMIZE" -pipe -Wall -Wextra -c "$PROGRAM".c "$SYMBOLS" |
| 83 | +gcc $CXXFLAGS -std=c++03 -Wno-unused-parameter -Wno-missing-field-initializers -c "$PROGRAM".cpp |
| 84 | + |
| 85 | +# Link "$PROGRAM" |
| 86 | +#gcc -I. -L. "$PROGRAM".o -o "$PROGRAM" "$SYMBOLS" "$OPTIMIZE" -lX11 -lXfixes -T/usr/local/lib/ldscripts/elf_i386.xbn |
| 87 | +gcc $LDFLAGS "$PROGRAM".o -o "$PROGRAM" -L/usr/lib -lfltk -lfltk_images -lfltk_forms -lpng -lstdc++ |
| 88 | + |
| 89 | +size "$PROGRAM".o "$PROGRAM" |
| 90 | +ls -l "$PROGRAM" |
| 91 | +if [ "$GDEBUG" == "No" ] |
| 92 | +then |
| 93 | + sstrip "$PROGRAM" |
| 94 | +fi |
| 95 | +ls -l "$PROGRAM" |
| 96 | + |
| 97 | +#exit |
| 98 | + |
| 99 | +cd "$STARTDIR" |
| 100 | + |
| 101 | +# Remove output from previous build. |
| 102 | +rm "$PROCESSOR_TYPE" |
| 103 | +rm "$PACKAGEDIR" |
| 104 | +rm *.tcz* |
| 105 | +rm *.gz |
| 106 | +rm *.bfe |
| 107 | + |
| 108 | +# Create the destination directories for packaging. |
| 109 | +mkdir "$PROCESSOR_TYPE" |
| 110 | +mkdir "$DESTDIR/bin" |
| 111 | +mkdir "$DESTDIR/share/applications" |
| 112 | +mkdir "$DESTDIR/share/doc/$PROGRAM" |
| 113 | +mkdir "$DESTDIR/share/pixmaps" |
| 114 | + |
| 115 | +# Copy program files to their final destination. |
| 116 | +cp "$STARTDIR/$SRCDIR/$PROGRAM" "$DESTDIR/bin" |
| 117 | +cp "$STARTDIR/$SRCDIR/$PROGRAM"_"fc.sh" "$DESTDIR/bin" |
| 118 | +cp "$STARTDIR/$SRCDIR/$PROGRAM.desktop" "$DESTDIR/share/applications" |
| 119 | +cp "$STARTDIR/$SRCDIR/$PROGRAM"_"help.htm" "$DESTDIR/share/doc/$PROGRAM" |
| 120 | +cp "$STARTDIR/$SRCDIR/$PROGRAM.gif" "$DESTDIR/share/doc/$PROGRAM" |
| 121 | +cp "$STARTDIR/$SRCDIR/$PROGRAM.png" "$DESTDIR/share/pixmaps" |
| 122 | + |
| 123 | +# Update version number and date in the help file. |
| 124 | +DATE=`date '+%b %d, %Y'` |
| 125 | +VERSION="`grep "#define APP_VER" $STARTDIR/$SRCDIR/fluff.cpp | cut -d' ' -f3 | tr -d '"'`" |
| 126 | +sed -i "s|.*<p>Version.*|<p>Version $VERSION, $DATE</p>|" "$DESTDIR/share/doc/$PROGRAM/$PROGRAM"_"help.htm" |
| 127 | + |
| 128 | +# Create .tcz, .md5,txt, and .list files. |
| 129 | +mksquashfs $PACKAGEDIR $PROGRAM.tcz -noappend -quiet -no-progress |
| 130 | +md5sum $PROGRAM.tcz > $PROGRAM.tcz.md5.txt |
| 131 | +cd "$PACKAGEDIR" |
| 132 | +# Find files including their path starting from the current directory, |
| 133 | +# cut the leading dot, sort it, and save it to the .list file. |
| 134 | +find . -not -type d | cut -c 2- | sort > ../$PROGRAM.tcz.list |
| 135 | +cd "$STARTDIR" |
| 136 | + |
| 137 | +# Create dependency file. |
| 138 | +for EXT in $PACKAGE_DEPS |
| 139 | +do |
| 140 | + echo "$EXT".tcz >> "$PROGRAM".tcz.dep |
| 141 | +done |
| 142 | + |
| 143 | +# Create .info file |
| 144 | +DATE=`date '+%Y/%m/%d'` |
| 145 | +SIZE="`du -h $PROGRAM.tcz | cut -f1`" |
| 146 | +echo "Title: $PROGRAM.tcz |
| 147 | +Description: File Manager |
| 148 | +Version: $VERSION |
| 149 | +Author: Michael A. Losh |
| 150 | +Original-site: http://tinycorelinux.com |
| 151 | +Copying-policy: GPLv3 |
| 152 | +Size: $SIZE |
| 153 | +Extension_by: Michael A. Losh |
| 154 | +Tags: File Manager fm |
| 155 | +Comments: Full Version including icon and |
| 156 | + .desktop file, suitable for Tiny Core 3.7 and later. |
| 157 | + Fluff is a fast, light utility for files. Fluff uses |
| 158 | + the FLTK user interface library, which makes it |
| 159 | + especially efficient on TinyCore Linux. The source code |
| 160 | + of Fluff is released under the GNU license. This file |
| 161 | + manager features a directory tree and file details list; |
| 162 | + keyboard, menu, and drag-and-drop file manipulations; |
| 163 | + automatic configurable program associations; trashbin with |
| 164 | + restore; file renaming; file property editing; and more! |
| 165 | + Less than 150 KB installed. |
| 166 | +
|
| 167 | +
|
| 168 | + Built with: |
| 169 | + CFLAGS=$CFLAGS |
| 170 | + CXXFLAGS=$CXXFLAGS |
| 171 | + LDFLAGS=$LDFLAGS |
| 172 | +
|
| 173 | +Change-log: 2011/05/13 (Initial release as extension) |
| 174 | + 2010/05/13 1.0.0 |
| 175 | + 2014/03/19 v1.0.7 compiled for corepure64-v5.x (coreplayer2) |
| 176 | + 2020/01/30 v1.0.7 compiled for tc-11.x and fltk-1.3.5 (gnuser) |
| 177 | + 2020/02/07 updated 1.0.7 -> 1.0.8 (gnuser) |
| 178 | +Current: $DATE $VERSION Reverted previous pointer changes, see fluff.cpp |
| 179 | +" > $PROGRAM.tcz.info |
| 180 | + |
| 181 | +# Check the newly created extension files for errors. |
| 182 | +submitqc --libs 2>&1 > submitqc.txt |
| 183 | + |
| 184 | +# Create archive of the package. |
| 185 | +tar -czf "$PROGRAM".tar.gz "$PROGRAM".tc* |
| 186 | + |
| 187 | +# Create archive of the source package. |
| 188 | +tar -czf "$PROGRAM"-source-"$VERSION".tar.gz --exclude "*.o" ../"$PROGRAM"/"$SRCDIR" ../"$PROGRAM"/Compile"$PROGRAM" |
| 189 | + |
| 190 | +# Tar the package archive and build script. Include processor type as part of archive name. |
| 191 | +tar -czf "$PROGRAM-$PROCESSOR_TYPE".tar.gz --exclude "$PROGRAM-$PROCESSOR_TYPE*" *.tar.gz |
| 192 | + |
| 193 | +# bcrypt the final file with the password tinycore |
| 194 | +yes tinycore | bcrypt "$PROGRAM-$PROCESSOR_TYPE".tar.gz |
| 195 | + |
| 196 | +# Save copies in the $PROCESSOR_TYPE directory in case we want |
| 197 | +# to compile for another architecture. |
| 198 | +cp "$SRCDIR/$PROGRAM" "$PROCESSOR_TYPE" |
| 199 | +cp "$PROGRAM".tc* "$PROCESSOR_TYPE" |
| 200 | +cp *.tar.gz* "$PROCESSOR_TYPE" |
| 201 | +cp submitqc.txt "$PROCESSOR_TYPE" |
| 202 | + |
| 203 | + |
| 204 | +echo "Check $PACKAGEDIR/submitqc.txt for any errors." |
| 205 | +echo "Send $PROGRAM-$PROCESSOR_TYPE.tar.gz.bfe to: tcesubmit@gmail.com" |
| 206 | +echo |
0 commit comments