Commit 6d9ee062 authored by Accident's avatar Accident

Accident: Adding in bd+ epoch, and simple build tools. It will not work
          since there is no way to set VolumeID, and needs to be re-tooled
          for universal debug logging.
parent 5bcce81e
SUBDIRS=src/libbdplus src/examples
EXTRA_DIST=README.txt
Generally, you do no check-in content that is generated. Like Binaries, *.o files etc, this includes Makefile.in, configure and so on. So when you check-out sources, first you run
autoreconf --force --install
and you get ./configure.
AC_INIT([libbluray],[0.1.0], [bug-report@bdplus])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign])
# Run ./configure in libaacs
#AC_CONFIG_SUBDIRS([src/libaacs])
# Run ./configure in libbdplus
AC_CONFIG_SUBDIRS([src/libbdplus])
# Run ./configure in examples
AC_CONFIG_SUBDIRS([src/examples])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
......@@ -6,6 +6,11 @@
#include "util/macro.h"
#include "util/logging.h"
#if HAVE_BDPLUS
#include "libbdplus/bdplus.h"
#endif
BLURAY *bd_open(const char* device_path, const char* keyfile_path)
{
BLURAY *bd = malloc(sizeof(BLURAY));
......
bin_PROGRAMS=bdplus_test
bdplus_test_SOURCE=bdplus_test.c
bdplus_test_LDADD=$(top_builddir)/../libbdplus/libbdplus.a
bdplus_test_CPPFLAGS = -I$(top_builddir)/../libbdplus
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#include <stdio.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include "bdplus.h"
extern int bluray_debuglevel; // FIXME
int main(int argc, char **argv)
{
VM *vm = NULL;
int result;
if (argc < 2) {
fprintf(stderr, "%s /path/tobluray\r\n", argv[0]);
fprintf(stderr, "Where we expect to find /path/tobluray/BDSVM/\r\n");
exit(1);
}
if (chdir(argv[1])) {
perror("chdir(): ");
exit(1);
}
// Technically not required, yet
if (bdplus_init()) goto fail;
// Debug flags?
bluray_debuglevel = 3;
// Create the VM
vm = bdplus_VM_new(0);
if (!vm) goto fail;
printf("Loading core...\n");
if (bdplus_loadsvm(vm, 0x0, "BDSVM/00000.svm")) {
printf("Unable to load BDSVM/00000.svm\n");
goto fail;
}
printf("Loading slots...\n");
bdplus_load_slots(vm, "flash.bin");
// Set VolumeID?
// if (bdplus_loadVolumeID(vm, "volume_id.bin")) {
printf("Running VM for convtab...\n");
result = bdplus_run_convtab(vm);
printf("run_convtab said %d\n", result);
printf("Cleaning up...\n");
fail:
if (vm) {
bdplus_VM_free(vm);
vm = NULL;
}
bdplus_free();
exit(0);
}
AC_INIT([examples],[0.1.0], [bug-report@bdplus])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign])
# The big search for OpenSSL
# copied from openssh's configure.ac
tryssldir=""
AC_ARG_WITH(ssl-dir,
[ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
[
if test "x$withval" != "xno" ; then
tryssldir=$withval
fi
]
)
AC_PROG_CC
AC_PROG_CXX
AC_CHECK_PROG(BUILD, build, build)
AC_TYPE_SIGNAL
AC_HEADER_TIME
AC_CHECK_HEADERS([stdarg.h varargs.h sys/time.h sys/types.h dirent.h sys/file.h sys/param.h sys/statfs.h sys/vfs.h sys/statvfs.h errno.h libgen.h time.h])
# mount depends on param
AC_CHECK_HEADERS([sys/mount.h], [], [], [#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif])
AC_STRUCT_DIRENT_D_TYPE
AH_TEMPLATE([NEED_SYS_ERRLIST_DECLARED],
[Define this if sys_errlist must be declared (if it exists).])
AC_SYS_LARGEFILE
AC_PROG_RANLIB
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([socket], [socket inet])
AC_SEARCH_LIBS([crypt], [crypt])
AC_SEARCH_LIBS([dlopen], [dl])
AC_CHECK_FUNC([snprintf],
[AC_DEFINE(HAVE_SNPRINTF,1,[Presence of snprintf found])],
[AC_MSG_WARN(Adding internal snprintf function)])
AC_CHECK_FUNC([strcasestr],
[AC_DEFINE(HAVE_STRCASESTR,1,[Presence of strcasestr found])],
[])
if test "x$ac_cv_prog_gcc" = xyes ; then
CFLAGS="$CFLAGS -Wall -g "
fi
AC_CHECK_FUNCS([strtoul strtouq strtoull strtoll])
dnl Where do you live, openssl? And how do we call you?
AC_ARG_WITH([openssl],
[AS_HELP_STRING([--without-openssl],[Disable openssl support])],
[],
[with_openssl=yes])
dnl If SSL was NOT disable, then go look for it.
if test x"$with_openssl" != x"no" ; then
AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssl_dir, [
saved_LIBS="$LIBS"
saved_LDFLAGS="$LDFLAGS"
saved_CPPFLAGS="$CPPFLAGS"
ssl_found=no
for ssldir in $tryssldir "" $prefix /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/athena /usr/pkg /opt /opt/openssl ; do
LDFLAGS="$saved_LDFLAGS"
LIBS="$saved_LIBS -lssl -lcrypto"
# Skip the directory if it isn't there.
if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
continue;
fi
if test ! -z "$ssldir" ; then
if test -d "$ssldir/lib" ; then
LDFLAGS="-L$ssldir/lib $LDFLAGS"
else
LDFLAGS="-L$ssldir $LDFLAGS"
fi
if test -d "$ssldir/include" ; then
CPPFLAGS="-I$ssldir/include $CPPFLAGS"
else
CPPFLAGS="-I$ssldir $CPPFLAGS"
fi
fi
# Can I link it?
AC_TRY_LINK([#include <openssl/rand.h>],
[ RAND_add((void*)0,0,0); ],
[ openssl_linked=yes ], [ openssl_linked=no ])
if test $openssl_linked = yes; then
if test ! -z "$ssldir" ; then
ac_cv_openssl_dir=$ssldir
else
ac_cv_openssl_dir="(system)"
fi
ssl_found=yes
break
fi
done
LIBS="$saved_LIBS"
LDFLAGS="$saved_LDFLAGS"
CPPFLAGS="$saved_CPPFLAGS"
if test $ssl_found = no ; then
AC_MSG_ERROR([Could not find a linkable OpenSSL. You can specify an explicit path using --with-ssl-dir])
fi
])
AC_DEFINE([WITH_SSL], 1, [Define if we found OpenSSL - Legacy name])
LIBS="$LIBS -lssl -lcrypto"
if test "$ac_cv_openssl_dir" != "(system)"; then
if test -d "$ac_cv_openssl_dir/lib" ; then
LDFLAGS="-L$ac_cv_openssl_dir/lib $LDFLAGS"
ssl_libdir="$ac_cv_openssl_dir/lib"
else
LDFLAGS="-L$ac_cv_openssl_dir $LDFLAGS"
ssl_libdir="$ac_cv_openssl_dir"
fi
if test -d "$ac_cv_openssl_dir/include" ; then
CPPFLAGS="-I$ac_cv_openssl_dir/include $CPPFLAGS"
else
CPPFLAGS="-I$ac_cv_openssl_dir $CPPFLAGS"
fi
fi
if test -z $CROSS_COMPILE
then
AC_CACHE_CHECK([whether we need extra options to link OpenSSL],
ac_cv_openssl_linker_option, [
saved_LDFLAGS="$LDFLAGS"
ssl_runs=no
linked_with=nothing
for ssl_extra in "" "-Wl,-R$ssl_libdir" "-R$ssl_libdir" ; do
LDFLAGS="$ssl_extra $saved_LDFLAGS"
AC_TRY_RUN([
#include <string.h>
#include <openssl/rand.h>
int main(void)
{
char a[2048];
memset(a, 0, sizeof(a));
RAND_add(a, sizeof(a), sizeof(a));
return(RAND_status() <= 0);
}
],
openssl_runs=yes, openssl_runs=no)
if test $openssl_runs = yes ; then
if test "$linked_with" = nothing; then
linked_with="$ssl_extra"
fi
AC_TRY_RUN([
#include <openssl/opensslv.h>
#include <openssl/crypto.h>
int main(void) {
return (OPENSSL_VERSION_NUMBER == SSLeay()) == 0;
}],
right_version=yes, right_version=no)
if test "$right_version" = yes; then
if test -z "$ssl_extra" ; then
ac_cv_openssl_linker_option='(none)'
else
ac_cv_openssl_linker_option=$ssl_extra
fi
ssl_runs=yes
break
fi
fi
done
if test $ssl_runs = no ; then
if test "$linked_with" = 'nothing' ; then
AC_MSG_ERROR([Found linkable OpenSSL in $ac_cv_openssl_dir, but it doesn't run, even with -R. Maybe specify another using --with-ssl-dir?])
else
if test -z "$linked_with" ; then
ac_cv_openssl_linker_option='(none)'
else
ac_cv_openssl_linker_option=$linked_with
fi
AC_MSG_WARN([I managed to make OpenSSL link and run, but I couldn't make it link against the same version I found header files for.])
fi
fi
LDFLAGS="$saved_LDFLAGS"
])
if test "$ac_cv_openssl_linker_option" != '(none)' ; then
LDFLAGS="$ac_cv_openssl_linker_option $LDFLAGS"
fi
fi
dnl if NOSSL
fi
dnl static build?
AC_ARG_ENABLE(static,
[ --enable-static Enable static linking [[default=no ]] ],
static="$enableval", static="no")
AC_MSG_CHECKING([for --enable-static])
AC_MSG_RESULT($static)
if test $static == yes; then
LDFLAGS="$LDFLAGS -static";
AC_DEFINE([STATIC_BUILD], [], [Define when making a static build])
fi
AM_CONFIG_HEADER(config.h)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment