Skip to content

Commit

Permalink
Use nmake to build on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bennettgoble committed Mar 31, 2024
1 parent b7fe4a3 commit 2d06050
Showing 1 changed file with 10 additions and 45 deletions.
55 changes: 10 additions & 45 deletions build-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

cd "$(dirname "$0")"

set -eu
set -e

PNG_SOURCE_DIR="libpng"

Expand Down Expand Up @@ -60,40 +60,24 @@ pushd "$PNG_SOURCE_DIR"

windows*)
load_vsvars

build_sln "projects/vstudio/vstudio.sln" "Release Library|$AUTOBUILD_WIN_VSPLATFORM" "pnglibconf"
build_sln "projects/vstudio/vstudio.sln" "Release Library|$AUTOBUILD_WIN_VSPLATFORM" "libpng"

TARGET_CPU=X64 \
INCLUDE="${INCLUDE:-};$(cygpath -w $stage/packages/include/zlib)" \
RUNTIME_LIBS=static \
LINK="${LINK:-};$(cygpath -w $stage/packages/lib/release)" \
nmake -f scripts/makefile.vcwin32

mkdir -p "$stage/lib/release"

if [ "$AUTOBUILD_ADDRSIZE" = 32 ]
then bitdir=projects/vstudio/Release\ Library
else bitdir=projects/vstudio/x64/Release\ Library
fi

cp -a "$bitdir/libpng16.lib" "$stage/lib/release/libpng16.lib"
cp -a "$bitdir/libpng16.bsc" "$stage/lib/release/"
cp libpng.lib "$stage/lib/release/"
mkdir -p "$stage/include/libpng16"
cp -a {png.h,pngconf.h,pnglibconf.h} "$stage/include/libpng16"
cp -a {png.h,pngconf.h,pnglibconf.h} "$stage/include/libpng"
;;

darwin*)
opts="${TARGET_OPTS:--arch $AUTOBUILD_CONFIGURE_ARCH $LL_BUILD_RELEASE}"
export CC=clang++

# Install name for dylibs (if we wanted to build them).
# The outline of a dylib build is here disabled by '#dylib#'
# comments. The basics: 'configure' won't tolerate an
# '-install_name' option in LDFLAGS so we have to use the
# 'install_name_tool' to modify the dylibs after-the-fact.
# This means that executables and test programs are built
# with a non-relative path which isn't ideal.
#
# Dylib builds should also have "-Wl,-headerpad_max_install_names"
# options to give the 'install_name_tool' space to work.
#
target_name="libpng16.16.dylib"
install_name="@executable_path/../Resources/${target_name}"

# Force libz static linkage by moving .dylibs out of the way
# (Libz is currently packaging only statics but keep this alive...)
trap restore_dylibs EXIT
Expand All @@ -112,25 +96,6 @@ pushd "$PNG_SOURCE_DIR"
--with-zlib-prefix="$stage/packages" --enable-shared=no --with-pic
make -j$AUTOBUILD_CPU_COUNT
make install
#dylib# install_name_tool -id "${install_name}" "${stage}/lib/release/${target_name}"

# conditionally run unit tests
#if [ "${DISABLE_UNIT_TESTS:-0}" = "0" ]; then
#dylib# mkdir -p ./Resources/
#dylib# ln -sf "${stage}"/lib/release/*.dylib ./Resources/

#make test
#dylib# Modify the unit test binaries after-the-fact to point
#dylib# to the expected path then run the tests again.
#dylib#
#dylib# install_name_tool -change "${stage}/lib/release/${target_name}" "${install_name}" .libs/pngtest
#dylib# install_name_tool -change "${stage}/lib/release/${target_name}" "${install_name}" .libs/pngstest
#dylib# install_name_tool -change "${stage}/lib/release/${target_name}" "${install_name}" .libs/pngunknown
#dylib# install_name_tool -change "${stage}/lib/release/${target_name}" "${install_name}" .libs/pngvalid
#dylib# make test

#dylib# rm -rf ./Resources/
#fi

# clean the build artifacts
make distclean
Expand Down

0 comments on commit 2d06050

Please sign in to comment.