All pastes #84054 Raw Edit

sonick

public text v1 · immutable
·published 2006-07-10 13:34 UTC
rendered paste body
#!/bin/sh
# Run this to generate the libgcrypt W32 DLL
#
# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

AS="/c/MinGW/bin/as"
OBJS=

grep "#define HAVE_DOSISH_SYSTEM" ../config.h
if [ $? = 1 ]; then
    exit
fi

for i in $(ls ../cipher/*.o); do
        OBJS="$OBJS $i"
done
for i in $(ls ../mpi/*.o); do
        OBJS="$OBJS $i"
done
for i in $(ls ../src/*.o); do
        OBJS="$OBJS $i"
done


# add asm code which is postfixed with .lo
OBJS="$OBJS ../mpi/mpih-sub1.o ../mpi/mpih-add1.o ../mpi/mpih-lshift.o"
OBJS="$OBJS ../mpi/mpih-mul2.o ../mpi/mpih-mul1.o ../mpi/mpih-rshift.o"
OBJS="$OBJS ../mpi/mpih-mul3.o"

echo 'running dlltool the first time' >&2
/c/MinGW/bin/dlltool --no-delete  \
        --as $AS \
        --def libgcrypt.def \
        --output-exp libgcrypt.exp \
        --output-lib libgcrypt.imp \
        --dllname libgcrypt.dll $OBJS
set -x
echo 'doing dummy link to create the base file' >&2
/c/MinGW/bin/gcc -Wall -mdll -Wl,--base-file -Wl,libgcrypt.base \
                        -o libgcrypt.dll libgcrypt.exp $OBJS
echo 'running dlltool the second time' >&2
/c/MinGW/bin/dlltool --no-delete \
                --as $AS \
                --def libgcrypt.def \
                --output-exp libgcrypt.exp \
        --output-lib libgcrypt.imp \
                --base-file libgcrypt.base \
                --dllname libgcrypt.dll $OBJS

echo 'doing final link' >&2
/c/MinGW/bin/gcc -mdll -o libgcrypt.dll libgcrypt.exp $OBJS
/c/MinGW/bin/strip libgcrypt.dll

/c/MinGW/bin/dlltool --def libgcrypt.def \
                        --as $AS \
                        --dllname libgcrypt.dll \
                        --output-lib libgcrypt.lib

echo 'clean up'
rm -f dh.o dh.s dt.o dt.s
rm -f libgcrypt.base libgcrypt.exp libgcrypt.imp tlibgcrypt.exp
set +x