Permalink
Browse files

Added Dockerfile for building win32 binary

  • Loading branch information...
dstosberg committed Jul 20, 2015
1 parent 796e62d commit 8ba26cda1f74eb44753fc1ad5d4fb78c328d9955
Showing with 64 additions and 28 deletions.
  1. +1 −28 INSTALL
  2. +63 −0 win32/Dockerfile
View
29 INSTALL
@@ -41,32 +41,5 @@ Windows (Cygwin):
You need to install libiconv.
Windows (mingw32):
This is a little harder, but will produce a binary that has no
further dependencies. I don't have a Windows system here but I have
a Debian Sarge system with a cross-compile environment. The
resulting binary has been reported to work without problems. I guess
the same process should work with a native mingw environment in a
similar way.
See win32/Dockerfile for a recipe build a windows package.
Install mingw32, mingw32-binutils and mingw32-runtime. Download and
untar GNU libiconv, configure and build and install it:
$ ./configure --host=i586-mingw32msvc --prefix=/usr/i586-mingw32msvc/
$ make
$ su -c "make install"
Download GNU regex-0.12, untar it (for example to /tmp/regex-0.12)
and compile the source file:
$ i586-mingw32msvc-gcc -DSTDC_HEADERS=1 -c regex.c
Then go into the odt2txt source directory and build it:
$ make CC=i586-mingw32msvc-gcc MINGW32=1 REGEX_DIR=/tmp/regex-0.12
The result should be a file named odt2txt.exe. The only dependency
is the file libiconv-2.dll which was built from your iconv source
directory.
You can also link statically against libiconv if you add
STATIC=1 ICONV_DIR=<your_iconv_dir> to the make command line.
View
@@ -0,0 +1,63 @@
# docker build -t odt2txt-win32 .
# docker run --rm -v /tmp:/dist odt2txt-win32
# docker rmi odt2txt-win32
FROM debian:jessie
RUN apt-get update \
&& apt-get dist-upgrade -y \
&& apt-get install -y build-essential \
&& apt-get install -y wget git mingw32 zip
USER nobody
RUN cd /tmp \
&& wget ftp://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz \
&& tar xzf libiconv-1.14.tar.gz \
&& cd libiconv-1.14 \
&& ./configure --host=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32/ \
&& make
USER root
RUN cd /tmp/libiconv-1.14 \
&& make install
USER nobody
RUN cd /tmp \
&& wget https://ftp.gnu.org/old-gnu/regex/regex-0.12.tar.gz \
&& tar xzf regex-0.12.tar.gz \
&& cd regex-0.12 \
&& i686-w64-mingw32-gcc -DSTDC_HEADERS=1 -c regex.c
RUN cd /tmp \
&& wget http://zlib.net/zlib-1.2.8.tar.gz \
&& tar xzf zlib-1.2.8.tar.gz \
&& cd zlib-1.2.8 \
&& make -f win32/Makefile.gcc PREFIX=i686-w64-mingw32-
RUN cd /tmp \
&& wget http://www.nih.at/libzip/libzip-1.0.1.tar.gz \
&& tar xzf libzip-1.0.1.tar.gz \
&& cd libzip-1.0.1 \
&& ./configure --host=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32/ --with-zlib=/tmp/zlib-1.2.8/ \
&& make
RUN cd /tmp \
&& git clone https://github.com/dstosberg/odt2txt \
&& cd odt2txt \
&& make CC=i686-w64-mingw32-gcc MINGW32=1 REGEX_DIR=/tmp/regex-0.12 ZLIB_DIR=/tmp/zlib-1.2.8 STATIC=1 ICONV_DIR=/tmp/libiconv-1.14 LIBZIP_DIR=/tmp/libzip-1.0.1/
RUN cd /tmp/odt2txt \
&& export VERSION=$(git describe --tags) \
&& export DIST_DIR=/tmp/odt2txt-$VERSION \
&& mkdir $DIST_DIR \
&& cd $DIST_DIR \
&& cp /tmp/odt2txt/odt2txt.exe . \
&& cp /tmp/odt2txt/README.md . \
&& cp /tmp/odt2txt/GPL-2 . \
&& cd .. \
&& zip -r odt2txt-${VERSION}.zip odt2txt-$VERSION \
&& echo "#!/bin/bash" > /tmp/copy-dist.sh \
&& echo "cp -v /tmp/odt2txt-${VERSION}.zip /dist" >> /tmp/copy-dist.sh
CMD sh /tmp/copy-dist.sh

0 comments on commit 8ba26cd

Please sign in to comment.