Unfortunately, your relink-binary.sh did not work for me:

./relink-binary.sh: line 14: libtool:: command not found

I'll prepare a patch to fix that.


--
Nadav Har'El
n...@scylladb.com

On Tue, Jul 11, 2017 at 3:28 PM, Nadav Har'El <n...@scylladb.com> wrote:

> Thanks. Looks good - I'll commit, none of the comments I have below are
> important.
>
> On Thu, Jun 15, 2017 at 1:31 PM, Justin Cinkelj <justin.cink...@xlab.si>
> wrote:
>
>> The iso-read from libcdio will be used to read ISO image
>> (contextualization CD, cloud metadata image). This will allow use of
>> standard ISO images in OSv cloud-init implementation, instead of using a
>> custom format (see 56c6195b252b127c7fe90cb9fa46c370b384b51a).
>>
>
> Thanks. I'm wondering whether the correct / convenient approach is what
> you did here - to compile
> libcdio ourselves - or just to assume it is installed on the build machine
> and copy that. But since you
> already did the compilation one, let's choose that approach.
>
>
>> Signed-off-by: Justin Cinkelj <justin.cink...@xlab.si>
>> ---
>>  modules/libcdio/.gitignore       |  2 ++
>>  modules/libcdio/Makefile         | 52 ++++++++++++++++++++++++++++++
>> ++++++++++
>>  modules/libcdio/exit.patch       | 14 +++++++++++
>>  modules/libcdio/module.py        | 13 ++++++++++
>>  modules/libcdio/relink-binary.sh | 14 +++++++++++
>>  5 files changed, 95 insertions(+)
>>  create mode 100644 modules/libcdio/.gitignore
>>  create mode 100644 modules/libcdio/Makefile
>>  create mode 100644 modules/libcdio/exit.patch
>>  create mode 100644 modules/libcdio/module.py
>>  create mode 100755 modules/libcdio/relink-binary.sh
>>
>> diff --git a/modules/libcdio/.gitignore b/modules/libcdio/.gitignore
>> new file mode 100644
>> index 0000000..5fc3ba0
>> --- /dev/null
>> +++ b/modules/libcdio/.gitignore
>> @@ -0,0 +1,2 @@
>> +build
>> +download
>> diff --git a/modules/libcdio/Makefile b/modules/libcdio/Makefile
>> new file mode 100644
>> index 0000000..c94ead2
>> --- /dev/null
>> +++ b/modules/libcdio/Makefile
>> @@ -0,0 +1,52 @@
>> +# A small Makefile "download and build" for libcdio
>> +
>> +# Directories for downloading and building
>> +DOWNLOAD=download
>> +BUILD=build
>> +
>> +# libcdio
>> +LIBCDIO_VERSION=0.94
>> +LIBCDIO_FOLDER=libcdio-$(LIBCDIO_VERSION)
>> +LIBCDIO_DOWNLOAD=https://ftp.gnu.org/gnu/libcdio/libcdio-$(
>> LIBCDIO_VERSION).tar.gz
>> +LIBCDIO_ARCHIVE=download/$(LIBCDIO_FOLDER).tar.gz
>> <https://ftp.gnu.org/gnu/libcdio/libcdio-$(LIBCDIO_VERSION).tar.gz+LIBCDIO_ARCHIVE=download/$(LIBCDIO_FOLDER).tar.gz>
>> +LIBCDIO_BUILD=$(BUILD)/$(LIBCDIO_FOLDER)
>> +
>> +CFLAGS:=-fPIC
>> +# libtool would ignore -shared anyway
>> +# We should set LDFLAGS=-shared. But then configure stage fails with
>> +# "configure: error: C compiler cannot create executables".
>> +# If we later edit Makefile to set LDFLAGS=-shared, then libtool removes
>> it.
>> +# So, we will capture required cmd from make V=1, and relink the binary.
>> +LDFLAGS:=
>>
>
> Interesting approach. In the lighttpd module I added a couple of days ago,
> I had the
> same problem, and sed a different approach - I sed'ed the actual libtool
> script and
> inserted the "-shared" there :-)
>
>
>> +
>> +MAIN=$(LIBCDIO_BUILD)/src/.libs/iso-read
>> +
>> +module: $(MAIN) $(MAIN).so
>>
>
> It should be enough to have $(MAIN).so.  It already depends on $(MAIN).
>
> +
>> +$(MAIN): $(LIBCDIO_BUILD)/Makefile
>> +       cd $(LIBCDIO_BUILD) && make
>> +
>> +$(MAIN).so: $(MAIN)
>> +       ./relink-binary.sh $@
>> +
>> +$(LIBCDIO_BUILD)/Makefile: $(LIBCDIO_BUILD)/configure
>> +       cd $(LIBCDIO_BUILD) && CFLAGS=$(CFLAGS) LDFLAGS=$(LDFLAGS)
>> ./configure
>> +
>> +$(LIBCDIO_BUILD)/configure: $(LIBCDIO_ARCHIVE) | $(BUILD)
>> +       cd $(BUILD) && tar xzf ../$(LIBCDIO_ARCHIVE)
>> +       cd $(LIBCDIO_BUILD) && patch -p1 < ../../exit.patch
>> +       touch $(LIBCDIO_BUILD)/configure
>> +
>> +$(LIBCDIO_ARCHIVE): | $(DOWNLOAD)
>> +       cd $(DOWNLOAD) && \
>> +               curl --remote-name --remote-time $(LIBCDIO_DOWNLOAD)
>> +
>> +$(DOWNLOAD) $(BUILD):
>> +       @mkdir -p $@
>> +
>> +clean:
>> +       rm -rf $(BUILD) $(DOWNLOAD)
>> +
>> +
>> +
>> +.PHONY: module clean
>> diff --git a/modules/libcdio/exit.patch b/modules/libcdio/exit.patch
>> new file mode 100644
>> index 0000000..403736c
>> --- /dev/null
>> +++ b/modules/libcdio/exit.patch
>> @@ -0,0 +1,14 @@
>> +diff --git a/lib/driver/logging.c b/lib/driver/logging.c
>> +index b89ab37..202256c 100644
>> +--- a/lib/driver/logging.c
>> ++++ b/lib/driver/logging.c
>> +@@ -49,7 +49,8 @@ cdio_default_log_handler(cdio_log_level_t level,
>> const char message[])
>> +         fprintf (stderr, "**ERROR: %s\n", message);
>> +         fflush (stderr);
>> +       }
>> +-      exit (EXIT_FAILURE);
>> ++      // Is triggered by invalid ISO image - input file smaller that
>> about 32 kB
>> ++      // exit (EXIT_FAILURE);
>>
>
> I'm curious what this is....
>
>
>> +       break;
>> +     case CDIO_LOG_DEBUG:
>> +       if (level >= cdio_loglevel_default) {
>> diff --git a/modules/libcdio/module.py b/modules/libcdio/module.py
>> new file mode 100644
>> index 0000000..f7b98d9
>> --- /dev/null
>> +++ b/modules/libcdio/module.py
>> @@ -0,0 +1,13 @@
>> +from osv.modules.filemap import FileMap
>> +
>> +VERSION=0.94
>> +
>> +usr_files = FileMap()
>> +usr_files.add('${OSV_BASE}/modules/libcdio/build/libcdio-%s/src/.libs'
>> % VERSION).to('/usr/bin') \
>> +       .include('iso-read.so')
>> +usr_files.add('${OSV_BASE}/modules/libcdio/build/libcdio-%s/lib/udf/.libs'
>> % VERSION).to('/usr/lib') \
>> +       .include('libudf.so.0')
>> +usr_files.add('${OSV_BASE}/modules/libcdio/build/libcdio-%s/lib/iso9660/.libs'
>> % VERSION).to('/usr/lib') \
>> +       .include('libiso9660.so.10')
>> +usr_files.add('${OSV_BASE}/modules/libcdio/build/libcdio-%s/lib/driver/.libs'
>> % VERSION).to('/usr/lib') \
>> +       .include('libcdio.so.16')
>> diff --git a/modules/libcdio/relink-binary.sh
>> b/modules/libcdio/relink-binary.sh
>> new file mode 100755
>> index 0000000..7a89f54
>> --- /dev/null
>> +++ b/modules/libcdio/relink-binary.sh
>> @@ -0,0 +1,14 @@
>> +#!/bin/bash
>> +
>> +set -ev
>> +
>> +BIN=$1
>> +SRC_DIR=$(dirname "$BIN")/..
>> +SRC_FILE_BASE=$(basename "$BIN" | sed 's/\.so$//')
>> +SRC_FILE=$SRC_FILE_BASE.c
>> +
>> +cd $SRC_DIR
>> +touch $SRC_FILE
>> +CMD1=$(make V=1 | grep "\-o .libs/$SRC_FILE_BASE")
>> +CMD2=$(echo $CMD1 | sed -e "s|^libtool: link: ccache ||" -e "s| -o
>> .libs/$SRC_FILE_BASE | -shared -o .libs/$SRC_FILE_BASE.so |")
>> +$CMD2
>> --
>> 2.9.3
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "OSv Development" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to osv-dev+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to