Skip to content

Commit

Permalink
WIP BROKEN libtifiles: add two variable types which are normally for …
Browse files Browse the repository at this point in the history
…internal use only; tifileutil: add the initial version of an in-tree libtifiles front-end (issue #31), so that it can be used by the libticalcs build; libticalcs: use tifileutil instead of tf2hex + tipack;

Temporarily integrate downstream Debian patch in tf2hex by Andi B. Mundt, possibly unnecessary for tifileutil ?

TODO use tifileutil in libticalcs' ROM dumper build.
TODO finish dump chexarray functionality (with more args and per-chunk read / write)
TODO use tifileutil dump chexarray instead of tf2hex in libticalcs
TODO delete tf2hex from libticalcs, simplify the build defs
TODO tifileutil manpage.
TODO tifileutil logging - more tifileutil_*(...), less fprintf(stderr, ...)
TODO tifileutil French translation.
TODO move this commit before the libticalcs TI-68k ROM dumper rewrite
TODO libticalcs simplify the TI-68k ROM dumper build by using tifileutil wrap instead of the custom as & ld header + footer which doesn't compute the trailing checksum.

Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
  • Loading branch information
debrouxl committed Dec 6, 2020
1 parent d5c3475 commit 5893af0
Show file tree
Hide file tree
Showing 28 changed files with 2,209 additions and 3 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ project(tilibs C CXX)
# - probably doesn't work very well with ancient toolchains or on uncommon OSes
#
# In the future...:
# - TODO: add support to build tifileutil
# - TODO: add support to build the ROM dumpers (will end up just launching the external tools...)
# - WISH: do not hardcode the (auto-generated...) potfiles_* target names
# - WISH: better expose each lib's generated install target (NTS: look at cmake's components feature?)
Expand Down
2 changes: 1 addition & 1 deletion libticalcs/trunk/src/tf2hex/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ CLEANFILES = tf2hex
all: tf2hex

tf2hex: tf2hex.cc
$(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) $(srcdir)/tf2hex.cc -o tf2hex
$(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) $(CPPFLAGS) $(LDFLAGS) $(srcdir)/tf2hex.cc -o tf2hex
4 changes: 2 additions & 2 deletions libtifiles/trunk/src/types83p.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ const TI83p_DATA TI83p_CONST[TI83p_MAXTYPES + 1] =
{"TABLE", "8Xt", "8Xt", "8Xt", "8Xt", "8Xt", "8Xt", "Table Setup", N_("Table Setup")},
{"", "8X?", "8X?", "8X?", "8X?", "8X?", "8X?", "Unknown", N_("Unknown")},
{"BKUP", "8Xb", "8Xb", "8Xb", "8Xb", "8Xb", "8Xb", "Backup", N_("Backup")},
{"", "8X?", "8X?", "8X?", "8X?", "8X?", "8X?", "Unknown", N_("Unknown")}, // 20, 0x14
{"APPOBJ", "8Xv", "8Xv", "8Xv", "8Xv", "8Xv", "8Xv", "Unknown", N_("App Obj")}, /* AppObj */ // 20, 0x14
{"APPV", "8Xv", "8Xv", "8Xv", "8Xv", "8Xv", "8Xv", "App Var", N_("App Var")},
{"TPRGM", "8Xp", "8Xp", "8Xp", "8Xp", "8Xp", "8Xp", "Program", N_("Program")}, /* TempProg */
{"TPRGM", "8Xp", "8Xp", "8Xp", "8Xp", "8Xp", "8Xp", "Program", N_("Program")}, /* TempProgObj */
{"GRP", "8Xo", "8Xo", "8Xo", "8Xo", "8Xo", "8Xo", "Group Var", N_("Group Var")}, // Also 8Xg
{"REAL", "8Xn", "8Xn", "8Xn", "8Xn", "8Xn", "8Xn", "Real", N_("Real")}, /* Fraction */
{"DIR", "8X?", "8X?", "8X?", "8X?", "8X?", "8X?", "Unknown", N_("Unknown")}, // 25, 0x19
Expand Down
2 changes: 2 additions & 0 deletions libtifiles/trunk/src/types83p.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
#define TI83p_TAB 0x11 //deprecated
#define TI83p_TABLE 0x11
#define TI83p_BKUP 0x13
#define TI83p_APPOBJ 0x14
#define TI83p_APPVAR 0x15 //deprecated
#define TI83p_APPV 0x15
#define TI83p_TEMPPROGOBJ 0x16
#define TI83p_GRP 0x17
#define TI83p_DIR 0x19
#define TI83p_AMS 0x23
Expand Down
2 changes: 2 additions & 0 deletions libtifiles/trunk/src/types84p.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@
#define TI84p_TAB 0x11 //deprecated
#define TI84p_TABLE 0x11
#define TI84p_BKUP 0x13
#define TI84p_APPOBJ 0x14
#define TI84p_APPVAR 0x15 //deprecated
#define TI84p_APPV 0x15
#define TI84p_TEMPPROGOBJ 0x16
#define TI84p_GROUP 0x17
#define TI83pce_SIMPLEFRAC 0x18
#define TI84p_DIR 0x19
Expand Down
22 changes: 22 additions & 0 deletions tifileutil/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Lionel Debroux: maintainer (2009-): tifileutil
==============================================

web: http://lpg.ticalc.org/prj_tilp , http://tict.ticalc.org , https://tiplanet.org
mail: lionel_debroux@yahoo.fr

Benjamin Moody (FloppusMaximus): tipack, etc.
=============================================

web: http://lpg.ticalc.org/prj_tilem/index.html
mail: benjamin.moody@gmail.com

Romain Liévin (roms): former maintainer (1999-2009), tf2hex
===========================================================

web: http://lpg.ticalc.org/prj_tilp
mail: roms@tilp.info

Jon Sturm (Jonimus): titools
============================

mail: jonimoose@gmail.com
339 changes: 339 additions & 0 deletions tifileutil/COPYING

Large diffs are not rendered by default.

Empty file added tifileutil/ChangeLog
Empty file.
18 changes: 18 additions & 0 deletions tifileutil/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Process this file with automake to produce Makefile.in

ACLOCAL_AMFLAGS=-I m4

# subdirectories to scan
SUBDIRS = build po src

if USE_GROFF
SUBDIRS += man
endif

dist_pkgdata_DATA = COPYING RELEASE

DISTCLEANFILES = ... intltool-extract intltool-merge intltool-update po/.intltool-merge-cache

EXTRA_DIST = README.* TODO

INTLTOOL_FILES = intltool-extract.in intltool-merge.in intltool-update.in
Empty file added tifileutil/NEWS
Empty file.
Empty file added tifileutil/README
Empty file.
Empty file added tifileutil/RELEASE
Empty file.
2 changes: 2 additions & 0 deletions tifileutil/build/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SUBDIRS = mingw
EXTRA_DIST = mingw
15 changes: 15 additions & 0 deletions tifileutil/build/mingw/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
BASE = tifileutil
RC ?= windres

EXTRA_DIST = $(BASE).rc

if OS_WIN32
noinst_DATA = $(BASE)-rc.o
endif

if OS_WIN32
all: $(BASE)-rc.o

$(BASE)-rc.o : $(BASE).rc
$(RC) $(BASE).rc $@
endif
43 changes: 43 additions & 0 deletions tifileutil/build/mingw/tifileutil.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////
//
// Version
//

#include "winver.h"

VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,1,0,0
PRODUCTVERSION 0,1,0,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS (VS_FF_PRERELEASE | VS_FF_DEBUG)
#else
FILEFLAGS (VS_FF_PRERELEASE)
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "This program is placed under GPL license. The license can be found on www.gnu.org\0"
VALUE "CompanyName", "Linux Programmer Group\0"
VALUE "FileDescription", "TI calculators file modification utility\0"
VALUE "FileVersion", "0.1.0\0"
VALUE "InternalName", "tifileutil\0"
VALUE "LegalCopyright", "Copyright \xA9 1999-2019, Romain Li\xE9vin, Julien Blache and contributors\0"
VALUE "LegalTrademarks", "The TiLP Team\0"
VALUE "OriginalFilename", "tifileutil.exe\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "TI file software for Linux, Windows Vista/7/8/8.1/10, Mac OS X and FreeBSD.\0"
VALUE "ProductVersion", "0.1.0\0"
VALUE "SpecialBuild", "Windows Vista/7/8/8.1/10 version\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
195 changes: 195 additions & 0 deletions tifileutil/configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
dnl Process this file with autoconf to produce a configure script.
dnl $Id$

# Init.
AC_PREREQ(2.57)
AC_INIT(TIFILEUTIL, 0.1, [tilp-users@lists.sourceforge.net])

dnl Release versioning info
VERSION="0.1"
AC_SUBST(VERSION)

AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE
AC_CONFIG_MACRO_DIR([m4])

AC_PREFIX_DEFAULT(/usr/local)

# Files to configure.
AC_CONFIG_SRCDIR([src/main.cc])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
build/Makefile
build/mingw/Makefile
man/Makefile
src/Makefile
])

# Setup libtool.
AC_DISABLE_STATIC
AC_LIBTOOL_WIN32_DLL
LT_INIT

# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LN_S
AC_ISC_POSIX
AC_PROG_AWK
AC_CHECK_PROG(GROFF, groff, yes, no)
AM_CONDITIONAL(USE_GROFF, test "$GROFF" != "no")
AC_CHECK_TOOL(RC, windres, windres)

# Translation
AC_PROG_INTLTOOL([0.40.0])

GETTEXT_PACKAGE=tifileutil
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [tifileutil])
AM_GLIB_GNU_GETTEXT

# Checks for libraries.
PKG_CHECK_MODULES(TICONV, ticonv >= 1.1.6)
AC_SUBST(TICONV_CFLAGS)
AC_SUBST(TICONV_LIBS)

PKG_CHECK_MODULES(TIFILES, tifiles2 >= 1.1.8)
AC_SUBST(TIFILES_CFLAGS)
AC_SUBST(TIFILES_LIBS)

PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.6.0)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_RESTRICT
AC_HEADER_STAT
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_STRUCT_TM

# Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_CHECK_FUNCS([memset strchr strdup strrchr localtime_r])

# Platform specific tests.
dnl AC_CANONICAL_HOST
case "$host" in
*-*-mingw*) ARCH="-D__WIN32__ -D__MINGW32__ -mwindows" ;;
*-*-cygwin) ARCH="-D__WIN32__ -D__CYGWIN__ -mwindows -mno-cygwin" ;;
*-*-*bsd*) ARCH="-D__BSD__" ;;
*) ARCH="-D__LINUX__" ;;
esac
CFLAGS="$CFLAGS $ARCH"

# Ensure MSVC-compatible struct packing convention is used when
# compiling for Win32 with gcc.
# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
# gcc2 uses "-fnative-struct".
case $host_os in
*mingw*|*cygwin*)
if test x$GCC = xyes; then
msnative_struct=''
AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
if test -z "$ac_cv_prog_CC"; then
our_gcc="$CC"
else
our_gcc="$ac_cv_prog_CC"
fi
case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
2.)
if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
msnative_struct='-fnative-struct'
fi
;;
*)
if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
msnative_struct='-mms-bitfields'
fi
;;
esac
if test x"$msnative_struct" = x ; then
AC_MSG_RESULT([no way])
AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
else
CFLAGS="$CFLAGS $msnative_struct"
AC_MSG_RESULT([${msnative_struct}])
fi
fi
;;
esac

AM_CONDITIONAL(OS_WIN32, test "$msnative_struct")

# Check for the new -fvisibility=hidden flag introduced in gcc 4.0
# Allow to reduce shared library size and avoid symbol clash
case $host_os in
*mingw*)
;;
*)
if test x$GCC = xyes; then
visibility_flag=''
AC_MSG_CHECKING([whether gcc accepts -fvisibility])
if test -z "$ac_cv_prog_CC"; then
our_gcc="$CC"
else
our_gcc="$ac_cv_prog_CC"
fi
if $our_gcc -v --help 2>/dev/null | grep "fvisibility" >/dev/null; then
visibility_flag='-fvisibility=hidden'
fi
if test x"$visibility_flag" = x ; then
AC_MSG_RESULT([no])
else
CFLAGS="$CFLAGS $visibility_flag"
AC_MSG_RESULT([${visibility_flag}])
AC_DEFINE(HAVE_FVISIBILITY, 1, [Use -fvisibility=hidden flag])
fi
fi
;;
esac

# Find a C compiler for the build system (needed for compiling cleaner)
AC_ARG_VAR([CC_FOR_BUILD], [C compiler for programs to be run on the build system])
AC_ARG_VAR([CFLAGS_FOR_BUILD], [C compiler flags for CC_FOR_BUILD])
AC_MSG_CHECKING([for the host compiler])
if test "x$build" == "x$host" ; then
# Not cross-compiling.
CC_FOR_BUILD=$CC
CFLAGS_FOR_BUILD=$CFLAGS
AC_MSG_RESULT([${CC_FOR_BUILD}])
else
# Try to find the host CC among several choices
AC_CHECK_PROGS(CC_FOR_BUILD, [gcc cc clang c89 c99], [false])
if test "x$CC_FOR_BUILD" = "xfalse" ; then
AC_MSG_FAILURE([not found.])
else
AC_MSG_RESULT([${CC_FOR_BUILD}])
fi
fi

# some extra flags
CXXFLAGS="$CFLAGS -fno-rtti -fno-exceptions"

AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(CXXFLAGS)

# Output.
AC_OUTPUT([
po/Makefile.in
])

echo "Now, you can type 'make' and 'make install'."
20 changes: 20 additions & 0 deletions tifileutil/man/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
man_MANS = tifileutil.1
pkgdata_DATA = Manpage.txt

EXTRA_DIST = $(man_MANS) cleaner.c Manpage.txt

all: dist_win

view: $(man_MANS)
groff -Tascii -man $(man_MANS) | less

Manpage.txt:
groff -Tascii -man $(man_MANS) > Manpage
C_INCLUDE_PATH="" LIBRARY_PATH="" $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) cleaner.c -o cleaner
./cleaner Manpage
rm -f Manpage cleaner

dist_win: $(man_MANS) Manpage.txt

clean:
rm -f Manpage.txt cleaner
Loading

0 comments on commit 5893af0

Please sign in to comment.