ROX-CLib: [PATCH] Improved build process

View: New views
3 Messages — Rating Filter:   Alert me  

ROX-CLib: [PATCH] Improved build process

by Thomas Leonard-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ROX-CLib uses a single application directory for the source code and
multiple binaries. It contains a shell script to try and do the right
thing (find a binary for the current platform or compile a new one).
This causes problems because:

- the library isn't at a known location relative to the appdir, so a
script has to be used to locate it
- the platform guessing often gets it wrong, especially on multi-arch
systems (if ROX-CLib contains 32- and 64-bit binaries then which one
to use depends on the architecture of the program calling it...
ROX-CLib has no way to know this and can either return the wrong one,
or try to compile a new binary... typically in a read-only directory).

This patch simplifies things by using a separate application directory
for the source and each generated binary. Running the source
application generates a binary application directory (using a GUI
provided by 0compile), one sub-directory per architecture. Running a
binary returns the pkg-config flags (for backwards compat; newer
programs can get this information without running it). The binary is
what you put on your LIBDIRPATH.

The GUI provides a button to register the new binary with 0launch
(which doesn't work due to a minor bug, fixed in 0compile's GIT repo;
"0launch --feed" on the binary's feed works, though).

Compiling currently assumes 0launch is available to provide a GUI for
the compilation, but it should be fairly simple to make it work
without if necessary (e.g. xterm).

Also, it's not too well tested, but I hope it gives the idea. What do you think?


Changes:
- Support VPATH, so src dir can be read-only during the build
- Set the architecture, icon and feed-for in the src feed correctly
- Use a relative path in the .pc file
- Separate the source and binary app-dirs
  - Running the source always compiles (NB: currently using 0compile only)
  - One binary app-dir for each platform => no platform guessing at run-time
- Added a 0compile.properties to allow easy in-place rebuilding from the
  ROX-CLib directory ("0compile build").
---
 0compile.properties |    7 +++++
 AppRun              |   71 +------------------------------------------------
 ROX-CLib-src.xml    |   25 ++++++++---------
 src/AppRun.in       |   12 ++++++++
 src/Makefile.in     |   74 +++++++++++++++++++++++++++-----------------------
 src/ROX-CLib.pc.in  |    3 +-
 src/configure.in    |   14 ---------
 src/pkg.c           |   70 +++++++++++++++++++++++------------------------
 8 files changed, 107 insertions(+), 169 deletions(-)
 create mode 100644 0compile.properties
 create mode 100755 src/AppRun.in



--
Dr Thomas Leonard ROX desktop / Zero Install
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1

[0001-Improved-build-process.patch]

From b9f5cc4a16f074caf9748c176c3d2c42e45442b8 Mon Sep 17 00:00:00 2001
From: Thomas Leonard <talex5@...>
Date: Sun, 26 Apr 2009 14:04:02 +0100
Subject: [PATCH] Improved build process

- Support VPATH, so src dir can be read-only during the build
- Set the architecture, icon and feed-for in the src feed correctly
- Use a relative path in the .pc file
- Separate the source and binary app-dirs
  - Running the source always compiles (NB: currently using 0compile only)
  - One binary app-dir for each platform => no platform guessing at run-time
- Added a 0compile.properties to allow easy in-place rebuilding from the
  ROX-CLib directory ("0compile build").
---
 0compile.properties |    7 +++++
 AppRun              |   71 +------------------------------------------------
 ROX-CLib-src.xml    |   25 ++++++++---------
 src/AppRun.in       |   12 ++++++++
 src/Makefile.in     |   74 +++++++++++++++++++++++++++-----------------------
 src/ROX-CLib.pc.in  |    3 +-
 src/configure.in    |   14 ---------
 src/pkg.c           |   70 +++++++++++++++++++++++------------------------
 8 files changed, 107 insertions(+), 169 deletions(-)
 create mode 100644 0compile.properties
 create mode 100755 src/AppRun.in

diff --git a/0compile.properties b/0compile.properties
new file mode 100644
index 0000000..41f4a26
--- /dev/null
+++ b/0compile.properties
@@ -0,0 +1,7 @@
+[compile]
+interface = /home/talex/rox/ROX-CLib/ROX-CLib-src.xml
+metadir = ROX-CLib
+download-base-url =
+version-modifier =
+selections =
+
diff --git a/AppRun b/AppRun
index bc84b39..fc6ad4b 100755
--- a/AppRun
+++ b/AppRun
@@ -1,74 +1,5 @@
 #!/bin/sh
-
-LIB=rox-clib
-
 APP_DIR=`dirname $0`
 APP_DIR=`cd "$APP_DIR";pwd`; export APP_DIR
 
-if [ "x$PLATFORM" = x ]; then
-
-  ARCH=`uname -m`
-  case $ARCH in
- i?86) ARCH=ix86 ;;
-  esac
-
-  PLATFORM=`uname -s`-$ARCH ; export PLATFORM
-fi
-
-if [ "x$MAKE" = x ]; then
-  MAKE=make export MAKE
-fi
-
-if [ "x$PKG_CONFIG_PATH" = x ]; then
-  PKG_CONFIG_PATH="$APP_DIR"/"$PLATFORM"/lib
-else
-  PKG_CONFIG_PATH="$APP_DIR"/"$PLATFORM"/lib:"$PKG_CONFIG_PATH"
-fi
-export PKG_CONFIG_PATH
-
-DEBUGGER=""
-
-case "$1" in
-    --xterm-compile)
-        exec xterm -e "$0" --compile;;
-    --compile)
- if [ ! -d "$APP_DIR"/src ] ; then
-    echo "ERROR from $0:" >&2
-    echo "Cannot compile - source code is missing!" >&2
-    exit 1
- fi
- echo "Compiling $APP_DIR... please wait..." >&2
- if [ ! -x "$APP_DIR/src/configure" ]; then
-    echo "No 'configure' script! Trying to run autoconf..."
-    (cd "$APP_DIR"/src; ./dist)
- fi
- rm -f "$APP_DIR"/src/config.cache "$APP_DIR"/src/Makefile
- cd "$APP_DIR"/src && ./configure --with-platform=$PLATFORM \
- && $MAKE clean && $MAKE  \
- && echo Done >&2 && exit 0
- echo Compile failed >&2
- echo Press Return... >&2
- read WAIT
- exit 1;;
-    --location)
-        exec echo "$APP_DIR";;
-esac
-
-BIN="$APP_DIR"/$PLATFORM/bin/pkg
-
-if [ -x "$BIN" ] ; then
-    exec $DEBUGGER "$BIN" "$@"
-else
-    echo "ERROR from $0:" >&2
-    echo "I cannot find an executable file for your host type ($PLATFORM)." >&2
-    echo "Trying to compile..." >&2
-    if [ -n "$DISPLAY" ]; then
- xterm -e "$0" --compile
-    else
- "$0" --compile
-    fi
-    if [ -x "$BIN" ]; then
- exec "$BIN" "$@"
-    fi
-    exit 1
-fi
+cd `dirname "$0"` && 0launch --not-before 0.15 http://0install.net/2006/interfaces/0compile.xml gui
diff --git a/ROX-CLib-src.xml b/ROX-CLib-src.xml
index 30c6b22..4e10f3d 100644
--- a/ROX-CLib-src.xml
+++ b/ROX-CLib-src.xml
@@ -1,33 +1,32 @@
 <?xml version="1.0" ?>
-<interface xmlns="http://zero-install.sourceforge.net/2004/injector/interface">
+<interface xmlns="http://zero-install.sourceforge.net/2004/injector/interface" xmlns:compile="http://zero-install.sourceforge.net/2006/namespaces/0compile">
   <name>ROX-CLib</name>
   <summary>C library for ROX programs</summary>
   <description>
-ROX-CLib is a library of support routines for programs intended to be
-part of the ROX desktop. It provides similar facilities for C
-programs as ROX-Lib provides for Python programs.
+ROX-CLib is a library of support routines for programs intended to be part of
+the ROX desktop. It provides similar facilities for C programs as ROX-Lib
+provides for Python programs.
 
-Other compiled languages, such as C++, can use this library.
-  </description>
+Other compiled languages, such as C++, can use this library.</description>
   <homepage>http://www.kerofin.demon.co.uk/rox/libs.html</homepage>
-  <icon type='image/png' href='http://www.kerofin.demon.co.uk/icons/ROX-CLib.png'/>
-  <group main='src/build'>
+  <icon href="http://www.kerofin.demon.co.uk/rox/ROX-CLib.png" type="image/png"/>
+  <feed-for interface='http://www.kerofin.demon.co.uk/2005/interfaces/ROX-CLib'/>
+  <group arch="*-src" compile:binary-main="AppRun" compile:command=""$SRCDIR/src/configure" && make">
     <requires interface="http://0install.net/2006/interfaces/GTK-dev">
-      <version not-before='2.4' before='2.6'/>
+      <version before="2.6" not-before="2.4"/>
       <environment insert="lib/pkgconfig" name="PKG_CONFIG_PATH"/>
       <environment insert="" name="GTKHEADERS"/>
     </requires>
     <requires interface="http://0install.net/2006/interfaces/GLib-dev">
-      <version not-before='2.4' before='2.6'/>
+      <version before="2.6" not-before="2.4"/>
       <environment insert="lib/pkgconfig" name="PKG_CONFIG_PATH"/>
       <environment insert="" name="GLIBHEADERS"/>
     </requires>
     <requires interface="http://0install.net/2006/interfaces/Pango-dev">
-      <version before='1.5'/>
+      <version before="1.5"/>
       <environment insert="lib/pkgconfig" name="PKG_CONFIG_PATH"/>
       <environment insert="" name="PANGOHEADERS"/>
     </requires>
-    <implementation version="2.1.10" released="snapshot" stability='testing' id="."/>
+    <implementation id="." version="2.1.10"/>
   </group>
 </interface>
-
diff --git a/src/AppRun.in b/src/AppRun.in
new file mode 100755
index 0000000..0e66ba0
--- /dev/null
+++ b/src/AppRun.in
@@ -0,0 +1,12 @@
+#!/bin/sh
+APP_DIR=`dirname $0`
+APP_DIR=`cd "$APP_DIR";pwd`; export APP_DIR
+
+if [ "x$PKG_CONFIG_PATH" = x ]; then
+  PKG_CONFIG_PATH="$APP_DIR"/lib
+else
+  PKG_CONFIG_PATH="$APP_DIR"/lib:"$PKG_CONFIG_PATH"
+fi
+export PKG_CONFIG_PATH
+
+`dirname "$0"`/bin/pkg "$@"
diff --git a/src/Makefile.in b/src/Makefile.in
index 3eae59f..b89f000 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,14 +1,13 @@
 # Makefile for ROX-CLib
 
+VPATH = $(SRCDIR)/src
 PKG_CONFIG = @PKG_CONFIG@
 GTK_CFLAGS = @GTK_CFLAGS@
 GTK_LIBS = @GTK_LIBS@
 XML_CONFIG = @XML_CONFIG@
 SHELL = @SHELL@
 srcdir = @srcdir@
-PLATFORM = @with_platform@
-PLATFORM_DIR = ../${PLATFORM}
-ABS_PLATFORM_DIR = ${shell pwd}/${PLATFORM_DIR}
+BINARY_APP_DIR = ${DISTDIR}/ROX-CLib
 SHARED = @SHLIB@
 top_builddir =  .
 LIBTOOL = @LIBTOOL@
@@ -25,10 +24,10 @@ LIBNAME = @LIBNAME@
 CC = @CC@
 CFLAGS = @CFLAGS@ -I. `${GTK_CFLAGS}` `${XML_CONFIG} --cflags` -DLIBNAME=\"${LIBNAME}\"
 LDFLAGS = @LDFLAGS@ `${GTK_LIBS}` `${XML_CONFIG} --libs` @LIBS@
-EXEC = ${PLATFORM_DIR}/bin/${PROG}
-LIBDIR = ${PLATFORM_DIR}/lib
-ABSLIBDIR = ${ABS_PLATFORM_DIR}/lib
-INCLUDEDIR = ${PLATFORM_DIR}/include/rox
+EXEC = ${BINARY_APP_DIR}/bin/${PROG}
+LIBDIR = ${BINARY_APP_DIR}/lib
+ABSLIBDIR = ${BINARY_APP_DIR}/lib
+INCLUDEDIR = ${BINARY_APP_DIR}/include/rox
 LIBFILE.a = ${LIBDIR}/lib${LIBNAME}.a
 LIBFILE.la = ${LIBDIR}/lib${LIBNAME}.la
 LTCOMPILE = ${LIBTOOL} --mode=compile ${CC} ${CFLAGS} -c
@@ -64,19 +63,26 @@ INCLUDES += rox_filer_action.h applet.h rox.h rox_soap_server.h
 INCLUDES += options.h basedir.h mime.h appinfo.h mime_handler.h uri.h
 INCLUDES += systray.h menu.h xattr.h
 
+APPDIR_FILES = AppInfo.xml ROX-CLib.xml .DirIcon
+
 ############ Things to keep the same
 
-all: ${EXEC} ${PLATFORM_DIR}/bin/rox_run ${PLATFORM_DIR}/bin/install_on_path
-all: ${PLATFORM_DIR}/bin/test ${PLATFORM_DIR}/bin/rox_pinboard
-all: ${PLATFORM_DIR}/bin/libdir ${PLATFORM_DIR}/bin/appdir
-all: ${PLATFORM_DIR}/lib/ROX-CLib.pc
+all: ${EXEC} ${BINARY_APP_DIR}/bin/rox_run ${BINARY_APP_DIR}/bin/install_on_path appdir
+all: ${BINARY_APP_DIR}/bin/test ${BINARY_APP_DIR}/bin/rox_pinboard
+all: ${BINARY_APP_DIR}/bin/libdir ${BINARY_APP_DIR}/bin/appdir
+all: ${BINARY_APP_DIR}/lib/ROX-CLib.pc
 all: ${LIBFILE.la}
 
+appdir:
+ for f in ${APPDIR_FILES}; do ${INSTALL_DATA} $(SRCDIR)/$$f ${BINARY_APP_DIR}; done
+ ${INSTALL_SCRIPT} ${SRCDIR}/src/AppRun.in ${BINARY_APP_DIR}/AppRun
+ cp -a ${SRCDIR}/Help ${BINARY_APP_DIR}/Help
+
 zero-install: all zero-install-shared
  rm *.o *.lo
  rm -rf .libs
- strip ${PLATFORM_DIR}/bin/test
- strip ${PLATFORM_DIR}/bin/rox_pinboard
+ strip ${BINARY_APP_DIR}/bin/test
+ strip ${BINARY_APP_DIR}/bin/rox_pinboard
  strip --strip-debug ${LIBFILE.a}
 
 zero-install-shared: ${LIBFILE.la}
@@ -85,43 +91,43 @@ zero-install-shared: ${LIBFILE.la}
 .c.lo:
  ${LTCOMPILE} $<
 
-${EXEC}: ${PLATFORM_DIR}/bin ${OBJECTS} ${LIBFILE.a} ${INCLUDEDIR}
+${EXEC}: ${BINARY_APP_DIR}/bin ${OBJECTS} ${LIBFILE.a} ${INCLUDEDIR}
  ${CC} -o ${EXEC} ${OBJECTS} ${LDFLAGS}
 
-${PLATFORM_DIR}/bin/test: ${PLATFORM_DIR}/bin test.o ${LIBFILE.la} ${INCLUDEDIR}
- ${CC} $(CFLAGS) -o ${PLATFORM_DIR}/bin/test test.o ${LDFLAGS} -L${LIBDIR} -l${LIBNAME}
+${BINARY_APP_DIR}/bin/test: ${BINARY_APP_DIR}/bin test.o ${LIBFILE.la} ${INCLUDEDIR}
+ ${CC} $(CFLAGS) -o ${BINARY_APP_DIR}/bin/test test.o ${LDFLAGS} -L${LIBDIR} -l${LIBNAME}
 
-${PLATFORM_DIR}/bin/rox_pinboard: ${PLATFORM_DIR}/bin rox_pinboard.o ${LIBFILE.a} ${INCLUDEDIR}
+${BINARY_APP_DIR}/bin/rox_pinboard: ${BINARY_APP_DIR}/bin rox_pinboard.o ${LIBFILE.a} ${INCLUDEDIR}
  ${CC} $(CFLAGS) -o $@ rox_pinboard.o ${LDFLAGS} -L${LIBDIR} -l${LIBNAME}
 
-${PLATFORM_DIR}/bin/rox_run: rox_run.sh
- cat rox_run.sh > $@
+${BINARY_APP_DIR}/bin/rox_run: rox_run.sh
+ cp "$<" "$@"
  chmod +x $@
 
-${PLATFORM_DIR}/bin/install_on_path: install_on_path.sh
- cat install_on_path.sh > $@
+${BINARY_APP_DIR}/bin/install_on_path: install_on_path.sh
+ cat $(SRCDIR)/src/install_on_path.sh > $@
  chmod +x $@
 
-${PLATFORM_DIR}/bin/libdir: libdir.sh
- sed -e "s/@mode@/libdir/" libdir.sh > $@
+${BINARY_APP_DIR}/bin/libdir: libdir.sh
+ sed -e "s/@mode@/libdir/" $(SRCDIR)/src/libdir.sh > $@
  chmod +x $@
 
-${PLATFORM_DIR}/bin/appdir: libdir.sh
- sed -e 's/@mode@/appdir/' libdir.sh > $@
+${BINARY_APP_DIR}/bin/appdir: libdir.sh
+ sed -e 's/@mode@/appdir/' $(SRCDIR)/src/libdir.sh > $@
  chmod +x $@
 
-${PLATFORM_DIR}:
- -mkdir ${PLATFORM_DIR}
+${BINARY_APP_DIR}:
+ -mkdir ${BINARY_APP_DIR}
 
-${PLATFORM_DIR}/bin: ${PLATFORM_DIR}
- -mkdir ${PLATFORM_DIR}/bin
+${BINARY_APP_DIR}/bin: ${BINARY_APP_DIR}
+ -mkdir ${BINARY_APP_DIR}/bin
 
-${LIBDIR}:  ${PLATFORM_DIR}
+${LIBDIR}:  ${BINARY_APP_DIR}
  -mkdir ${LIBDIR}
 
-${INCLUDEDIR}:  ${PLATFORM_DIR} ${INCLUDES}
+${INCLUDEDIR}:  ${BINARY_APP_DIR} ${INCLUDES}
  -mkdir -p ${INCLUDEDIR}
- for f in ${INCLUDES}; do ${INSTALL_DATA} $$f ${INCLUDEDIR}; done
+ for f in ${INCLUDES}; do ${INSTALL_DATA} $(SRCDIR)/src/$$f ${INCLUDEDIR}; done
  -( cd ${INCLUDEDIR}/.. ; ln -s rox/*.h . )
 
 ${LIBFILE.a}: ${LIBDIR} ${LIBOBJECTS}
@@ -132,8 +138,8 @@ ${LIBFILE.la}: ${LIBDIR} ${SLIBOBJECTS}
  ${LIBTOOL} --mode=install $(INSTALL) lib${LIBNAME}.la ${ABSLIBDIR}
  ${LIBTOOL} --mode=finish ${ABSLIBDIR}
 
-${PLATFORM_DIR}/lib/ROX-CLib.pc: ROX-CLib.pc.in Makefile
- sed -e 's/@PLATFORM@/${PLATFORM}/' -e 's/@VERSION@/${ROXCLIB_VERSION_NUM}/' ROX-CLib.pc.in > $@
+${BINARY_APP_DIR}/lib/ROX-CLib.pc: ROX-CLib.pc.in Makefile
+ sed -e 's/@VERSION@/${ROXCLIB_VERSION_NUM}/' $(SRCDIR)/src/ROX-CLib.pc.in > $@
 
 messages.pot: $(SRCS)
  xgettext --keyword=_ --keyword=N_ --output=messages.pot $(SRCS)
diff --git a/src/ROX-CLib.pc.in b/src/ROX-CLib.pc.in
index 59a8576..e5ad8db 100644
--- a/src/ROX-CLib.pc.in
+++ b/src/ROX-CLib.pc.in
@@ -1,5 +1,4 @@
-platform=@PLATFORM@
-prefix=${APP_DIR}/@PLATFORM@
+prefix=${pcfiledir}/..
 exec_prefix=${prefix}/bin
 libdir=${prefix}/lib
 includedir=${prefix}/include
diff --git a/src/configure.in b/src/configure.in
index 3e705af..d751da5 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -2,20 +2,6 @@ dnl Process this file with autoconf to produce a configure script.
 AC_INIT(pkg.c)
 AC_CONFIG_HEADER(rox-clib.h)
 
-AC_ARG_WITH(platform,
-[  --with-platform  platform name, as detected by AppRun],
-[AC_SUBST(with_platform)],
-[
-AC_MSG_ERROR([
-
-Please do not run 'configure' manually - instead, run the AppRun script with
-the --compile option, like this:
- $ ROX-CLib/AppRun --compile
-
-Thank you.
-])
-])
-
 AC_ARG_ENABLE(shlib,
   --enable-shlib  Build shared library (yes),
  SHLIB=$enable_val, SHLIB=yes)
diff --git a/src/pkg.c b/src/pkg.c
index 2f3649a..09991c0 100644
--- a/src/pkg.c
+++ b/src/pkg.c
@@ -14,26 +14,28 @@
 #define LIB_IS_FINAL
 #include "rox-clib.h"
 
-static int do_cflags(const char *app_dir, const char *platform,
+static int do_cflags(const char *app_dir,
      char **args);
-static int do_libs(const char *app_dir, const char *platform,
+static int do_libs(const char *app_dir,
      char **args);
-static int do_runtime(const char *app_dir, const char *platform,
+static int do_runtime(const char *app_dir,
      char **args);
-static int do_env(const char *app_dir, const char *platform,
+static int do_env(const char *app_dir,
      char **args);
-static int do_pkgconfig(const char *app_dir, const char *platform,
+static int do_pkgconfig(const char *app_dir,
      char **args);
 
-static int do_help(const char *app_dir, const char *platform,
+static int do_help(const char *app_dir,
      char **args);
-static int do_version(const char *app_dir, const char *platform,
+static int do_version(const char *app_dir,
+     char **args);
+static int do_location(const char *app_dir,
      char **args);
 
-static int run_pkgconfig(const char *app_dir, const char *platform,
+static int run_pkgconfig(const char *app_dir,
   const char *flag);
 
-typedef int (*action)(const char *app_dir, const char *platform, char **args);
+typedef int (*action)(const char *app_dir, char **args);
 
 typedef struct handler {
   char sopt;
@@ -53,6 +55,7 @@ static Handler handlers[]={
   
   {'h', "help",    do_help,    N_("Print help message")},
   {'v', "version", do_version, N_("Print short version information")},
+  {'L', "location", do_location, N_("Print the location of ROX-CLib")},
 
   {0, NULL, NULL, NULL}
 };
@@ -64,7 +67,6 @@ int main(int argc, char *argv[])
   int i;
   int state=0;
   const char *app_dir=getenv("APP_DIR");
-  const char *platform=getenv("PLATFORM");
 
   argv0=argv[0];
   
@@ -73,11 +75,6 @@ int main(int argc, char *argv[])
     argv0);
     exit(1);
   }
-  if(!platform) {
-    fprintf(stderr, _("%s: PLATFORM not set!  Are you running AppRun?\n"),
-    argv0);
-    exit(1);
-  }
 
   for(i=1; i<argc; i++) {
     if(argv[i][0]!='-') {
@@ -88,7 +85,7 @@ int main(int argc, char *argv[])
 
  for(h=handlers; h->lopt; h++) {
   if(strcmp(argv[i]+2, h->lopt)==0) {
-    state+=h->func(app_dir, platform, argv+i+1);
+    state+=h->func(app_dir, argv+i+1);
     break;
   }
  }
@@ -104,7 +101,7 @@ int main(int argc, char *argv[])
 
   for(h=handlers; h->sopt; h++) {
     if(argv[i][j]==h->sopt) {
-      state+=h->func(app_dir, platform, argv+i+1);
+      state+=h->func(app_dir, argv+i+1);
       break;
     }
   }
@@ -121,7 +118,7 @@ int main(int argc, char *argv[])
   return state;
 }
 
-static int run_pkgconfig(const char *app_dir, const char *platform,
+static int run_pkgconfig(const char *app_dir,
   const char *flag)
 {
   gchar *cmd;
@@ -135,24 +132,24 @@ static int run_pkgconfig(const char *app_dir, const char *platform,
   return stat;
 }
 
-static int do_cflags(const char *app_dir, const char *platform, char **args)
+static int do_cflags(const char *app_dir, char **args)
 {
-  return run_pkgconfig(app_dir, platform, "--cflags");
+  return run_pkgconfig(app_dir, "--cflags");
 }
 
-static int do_libs(const char *app_dir, const char *platform, char **args)
+static int do_libs(const char *app_dir, char **args)
 {
-  return run_pkgconfig(app_dir, platform, "--libs");
+  return run_pkgconfig(app_dir, "--libs");
 }
 
-static int do_runtime(const char *app_dir, const char *platform, char **args)
+static int do_runtime(const char *app_dir, char **args)
 {
-  printf("%s/%s/lib", app_dir, platform);
+  printf("%s/lib", app_dir);
 
   return 0;
 }
 
-static int do_help(const char *app_dir, const char *platform, char **args)
+static int do_help(const char *app_dir, char **args)
 {
   Handler *h;
   
@@ -163,31 +160,32 @@ static int do_help(const char *app_dir, const char *platform, char **args)
   for(h=handlers; h->lopt; h++)
     printf(" -%c --%s\t%s\n", h->sopt, h->lopt, _(h->help));
 
-  printf("    --%s\t%s\n", "compile", _("Build the library"));
-  printf("    --%s\t%s\n", "xterm-compile",
- _("Build the library, first executing an xterm window to "
-   "show the output"));
-  printf("    --%s\t%s\n", "location", _("Print the location of ROX-CLib"));
-
   return 0;
 }
 
-static int do_version(const char *app_dir, const char *platform, char **args)
+static int do_version(const char *app_dir, char **args)
 {
   printf("%s %s\n", LIB_PROJECT, LIB_VERSION);
 
   return 0;
 }
 
-static int do_env(const char *app_dir, const char *platform,
+static int do_location(const char *app_dir, char **args)
+{
+  printf("%s\n", app_dir);
+
+  return 0;
+}
+
+static int do_env(const char *app_dir,
      char **args)
 {
-  printf("LD_LIBRARY_PATH=%s/%s/lib:$LD_LIBRARY_PATH "
- "export LD_LIBRARY_PATH\n", app_dir, platform);
+  printf("LD_LIBRARY_PATH=%s/lib:$LD_LIBRARY_PATH "
+ "export LD_LIBRARY_PATH\n", app_dir);
   return 0;
 }
 
-static int do_pkgconfig(const char *app_dir, const char *platform,
+static int do_pkgconfig(const char *app_dir,
      char **args)
 {
   int narg, i;
--
1.6.0.4



------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
rox-devel mailing list
rox-devel@...
https://lists.sourceforge.net/lists/listinfo/rox-devel

Re: ROX-CLib: [PATCH] Improved build process

by Thomas Leonard-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/4/26 Thomas Leonard <talex5@...>:

> ROX-CLib uses a single application directory for the source code and
> multiple binaries. It contains a shell script to try and do the right
> thing (find a binary for the current platform or compile a new one).
> This causes problems because:
>
> - the library isn't at a known location relative to the appdir, so a
> script has to be used to locate it
> - the platform guessing often gets it wrong, especially on multi-arch
> systems (if ROX-CLib contains 32- and 64-bit binaries then which one
> to use depends on the architecture of the program calling it...
> ROX-CLib has no way to know this and can either return the wrong one,
> or try to compile a new binary... typically in a read-only directory).
>
> This patch simplifies things by using a separate application directory
> for the source and each generated binary. Running the source
> application generates a binary application directory (using a GUI
> provided by 0compile), one sub-directory per architecture. Running a
> binary returns the pkg-config flags (for backwards compat; newer
> programs can get this information without running it). The binary is
> what you put on your LIBDIRPATH.
>
> The GUI provides a button to register the new binary with 0launch
> (which doesn't work due to a minor bug, fixed in 0compile's GIT repo;
> "0launch --feed" on the binary's feed works, though).

I've made a new release of 0compile which fixes this.

I've also put a summary of the other new build changes on the blog:

http://roscidus.com/desktop/node/942

Comments?


--
Dr Thomas Leonard ROX desktop / Zero Install
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
rox-devel mailing list
rox-devel@...
https://lists.sourceforge.net/lists/listinfo/rox-devel

Re: ROX-CLib: [PATCH] Improved build process

by Stephen Watson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thomas Leonard <talex5@...> wrote:

> Compiling currently assumes 0launch is available to provide a GUI for
> the compilation, but it should be fairly simple to make it work
> without if necessary (e.g. xterm).

I'm not going to switch to a system that requires zero install.  It has to
be possible to build ROX-CLib without installing zero install first.

--
Stephen Watson     http://www.kerofin.demon.co.uk/
If you read this on a mailing list, send any reply back to the list and not
to me.  Not even CC.
Strange as I seem I'm getting stranger by the minute

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
rox-devel mailing list
rox-devel@...
https://lists.sourceforge.net/lists/listinfo/rox-devel