Skip to content

Commit

Permalink
Merge pull request pharo-project#128 from OpenSmalltalk/build_pharo_w…
Browse files Browse the repository at this point in the history
…in32_with_cygwin

Build pharo 32 and 64 bits version on appveyor with cygwin
  • Loading branch information
nicolas-cellier-aka-nice authored Mar 19, 2017
2 parents c387052 + 311c4eb commit b5f5768
Show file tree
Hide file tree
Showing 49 changed files with 771 additions and 84 deletions.
12 changes: 11 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ environment:
CYG_ROOT: C:\cygwin
CYG_SETUP: setup-x86.exe
MINGW_ARCH: i686
- FLAVOR: pharo.cog.spur
ARCH: win32x86
CYG_ROOT: C:\cygwin
CYG_SETUP: setup-x86.exe
MINGW_ARCH: i686
- FLAVOR: newspeak.cog.spur
ARCH: win32x86
CYG_ROOT: C:\cygwin
Expand All @@ -43,6 +48,11 @@ environment:
CYG_ROOT: C:\cygwin64
CYG_SETUP: setup-x86_64.exe
MINGW_ARCH: x86_64
- FLAVOR: pharo.stack.spur
ARCH: win64x64
CYG_ROOT: C:\cygwin64
CYG_SETUP: setup-x86_64.exe
MINGW_ARCH: x86_64

matrix:
fast_finish: false
Expand All @@ -58,7 +68,7 @@ cache:
install:
- ps: 'Start-FileDownload "http://cygwin.com/setup-x86.exe" -FileName "setup-x86.exe"'
- ps: 'Start-FileDownload "http://cygwin.com/setup-x86_64.exe" -FileName "setup-x86_64.exe"'
- '%CYG_SETUP% -dgnqNO -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_ROOT%\var\cache\setup" -P mingw64-%MINGW_ARCH%-gcc-core,mingw64-%MINGW_ARCH%-gcc-g++,mingw64-%MINGW_ARCH%-headers,mingw64-%MINGW_ARCH%-runtime,zip,mingw64-%MINGW_ARCH%-clang'
- '%CYG_SETUP% -dgnqNO -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_ROOT%\var\cache\setup" -P mingw64-%MINGW_ARCH%-gcc-core,mingw64-%MINGW_ARCH%-gcc-g++,mingw64-%MINGW_ARCH%-headers,mingw64-%MINGW_ARCH%-runtime,zip,mingw64-%MINGW_ARCH%-clang,libiconv-devel,libglib2.0-devel,perl,mingw64-%MINGW_ARCH%-zlib,cmake,mingw64-%MINGW_ARCH%-win-iconv'

build: false

Expand Down
2 changes: 1 addition & 1 deletion build.win32x86/common/Makefile.lib.extra
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#
#
# THIRDPARTYLIBS The libraries to build (you define them in ./third-party/LIB/Makefile.lib)
# THIRDPARTYDIR Where to build libraries
# THIRDPARTYOUTDIR Where to first install libraries (output place)
Expand Down
28 changes: 15 additions & 13 deletions build.win32x86/pharo.cog.spur.lowcode/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#############################################################################
# Makefile for Win32 Cog Spur PharoVM using gcc-3.4.x and cygwin
# Makefile for Win32 Cog Spur PharoVM using gcc and cygwin
# Do make init to allow make -n to function.
#############################################################################

Expand All @@ -12,24 +12,26 @@ VMSRCDIR:=../../spurlowcodesrc/vm
# ALLOCA_LIES_SO_USE_GETSP=0 Some compilers return the stack address+4 on alloca function,
# then FFI module needs to adjust that. It is NOT the case of mingw.
# For more information see this thread: http://forum.world.st/There-are-something-fishy-with-FFI-plugin-td4584226.html
COGDEFS:= -DPharoVM=1 -DIMMUTABILITY=1 -DSTACK_ALIGN_BYTES=16 -DALLOCA_LIES_SO_USE_GETSP=0
#COGDEFS:= -DPharoVM=1 -DIMMUTABILITY=1 -DSTACK_ALIGN_BYTES=16 -DALLOCA_LIES_SO_USE_GETSP=0
COGDEFS:= -DPharoVM=1 -DIMMUTABILITY=1

THIRDPARTYLIBS:=pkgconfig openssl libssh2 libgit2 libsdl2 zlib libpng freetype2 pixman cairo
THIRDPARTYLIBS:=pkgconfig openssl libssh2 libgit2 libsdl2 zlib libpng freetype2 pixman cairo libgcc

include ../common/Makefile

# third-party libraries
#
include ../third-party/pkgconfig/Makefile.lib
include ../third-party/freetype2/Makefile.lib
include ../third-party/openssl/Makefile.lib
include ../third-party/libssh2/Makefile.lib
include ../third-party/libgit2/Makefile.lib
include ../third-party/libsdl2/Makefile.lib
include ../third-party/zlib/Makefile.lib
include ../third-party/pixman/Makefile.lib
include ../third-party/libpng/Makefile.lib
include ../third-party/cairo/Makefile.lib
include ../third-party/Makefile.pkgconfig
include ../third-party/Makefile.freetype2
include ../third-party/Makefile.openssl
include ../third-party/Makefile.libssh2
include ../third-party/Makefile.libgit2
include ../third-party/Makefile.libsdl2
include ../third-party/Makefile.zlib
include ../third-party/Makefile.pixman
include ../third-party/Makefile.libpng
include ../third-party/Makefile.cairo
include ../third-party/Makefile.libgcc

# Since SDLDisplayPlugin will be included as internal plugin, we need to add the library to the path
# add to the end to allow thirdparty vars to be defined.
Expand Down
4 changes: 2 additions & 2 deletions build.win32x86/pharo.cog.spur.lowcode/Pharo.exe.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="*"
name="www.mirandabanda.org.Cog.Squeak"
name="www.mirandabanda.org.Cog.Pharo"
type="win32"
/>
<description>Squeak Smalltalk Virtual Machine</description>
<description>Pharo Smalltalk Virtual Machine</description>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>false</dpiAware>
Expand Down
8 changes: 4 additions & 4 deletions build.win32x86/pharo.cog.spur.lowcode/Pharo.rc
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ BEGIN
BEGIN
BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilin
BEGIN
VALUE "CompanyName", "Squeak.org\0"
VALUE "FileDescription", "Squeak Cog Spur Virtual Machine\0"
VALUE "CompanyName", "Pharo.org\0"
VALUE "FileDescription", "Pharo Cog Spur Virtual Machine\0"
VALUE "FileVersion", FILEVERSIONSTRING
VALUE "LegalCopyright", "Copyright \251 Squeak.org 1996-2014\0"
VALUE "ProductName", "Squeak Cog Spur\0"
VALUE "LegalCopyright", "Copyright \251 https://github.com/opensmalltalk 1996-2016\0"
VALUE "ProductName", "Pharo Cog Spur\0"
VALUE "ProductVersion", "5.0\0"
END
END
Expand Down
6 changes: 3 additions & 3 deletions build.win32x86/pharo.cog.spur.lowcode/mvm
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ else
fi
if [ -n "$D" ]; then
rm -rf builddbg/vm/*.exe
make $@ debug 2>&1 | tee LOGD
make $@ debug 2>&1 | tee LOGD ; test ${PIPESTATUS[0]} -eq 0
fi
if [ -n "$A" ]; then
rm -rf buildast/vm/*.exe
make $@ assert 2>&1 | tee LOGA
make $@ assert 2>&1 | tee LOGA ; test ${PIPESTATUS[0]} -eq 0
fi
if [ -n "$F" ]; then
rm -rf build/vm/*.exe
make $@ 2>&1 | tee LOGF
make $@ 2>&1 | tee LOGF ; test ${PIPESTATUS[0]} -eq 0
fi
2 changes: 1 addition & 1 deletion build.win32x86/pharo.cog.spur/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#############################################################################
# Makefile for Win32 Cog Spur PharoVM using gcc-3.4.x and cygwin
# Makefile for Win32 Cog Spur PharoVM using gcc and cygwin
# Do make init to allow make -n to function.
#############################################################################

Expand Down
6 changes: 3 additions & 3 deletions build.win32x86/pharo.cog.spur/mvm
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ else
fi
if [ -n "$D" ]; then
rm -rf builddbg/vm/*.exe
make $@ debug 2>&1 | tee LOGD
make $@ debug 2>&1 | tee LOGD ; test ${PIPESTATUS[0]} -eq 0
fi
if [ -n "$A" ]; then
rm -rf buildast/vm/*.exe
make $@ assert 2>&1 | tee LOGA
make $@ assert 2>&1 | tee LOGA ; test ${PIPESTATUS[0]} -eq 0
fi
if [ -n "$F" ]; then
rm -rf build/vm/*.exe
make $@ 2>&1 | tee LOGF
make $@ 2>&1 | tee LOGF ; test ${PIPESTATUS[0]} -eq 0
fi
17 changes: 11 additions & 6 deletions build.win32x86/third-party/Makefile.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,29 @@ PLUGINREQS:=$(THIRDPARTYLIBS)
$(CAIROARCHIVE):
$(WGET) -O $(CAIROARCHIVE) $(CAIROURL)

# IMPORTANT: This hack of "echo..." is needed to properly compile cairo.
# this is a long time error reported by Igor a lot of time ago:
# https://lists.cairographics.org/archives/cairo/2012-October/023675.html
# nobody answered his concern at the time and today (version 1.14.6),
# this is still not solved.
# IMPORTANT: The hack for editing test/Makefile after ./configure
# is required on cygwin because it fails to truncate the file
# test/cairo-test-constructors.c
# when it overwrites it, causing compilation to fail on trailing lines
# We thus add a rule for removing the file before generating it if it exists
# sed '/pattern/i newLine'
# This works in version 1.14.28 but somehow fragile.
# If this cygwin bug is confirmed, the line should be added to Makefile.am
# and any other relevant file, and the change pushed back to cairo repository.
$(THIRDPARTYLIBDIR)/$(CAIROLIBNAME): $(CAIROARCHIVE)
tar x -f $(CAIROARCHIVE) -C $(THIRDPARTYDIR)
cd $(CAIRODIR) \
&& ./configure \
--prefix="$(THIRDPARTYOUTDIR)" \
--host=i686-w64-mingw32 \
PKG_CONFIG="$(PKG_CONFIG)" \
PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" \
CFLAGS='$(THIRDPARTY_CFLAGS) -I$(THIRDPARTYINCLUDEDIR) -march=pentium4' \
LDFLAGS='$(THIRDPARTY_LDFLAGS) -L$(THIRDPARTYLIBDIR) -march=pentium4' \
--disable-silent-rules \
--disable-xlib \
--disable-dependency-tracking \
&& echo "#define _SSIZE_T_DEFINED 1" >> config.h \
&& sed -i '/.* sh .\/make-/i\\ttest -e \$$\@ \&\& rm \$$\@' test/Makefile \
&& make \
&& make install

Expand Down
17 changes: 9 additions & 8 deletions build.win32x86/third-party/Makefile.freetype2
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ $(FREETYPE2ARCHIVE):

$(THIRDPARTYLIBDIR)/$(FREETYPE2LIBNAME): $(FREETYPE2ARCHIVE)
tar x -f $(FREETYPE2ARCHIVE) -C $(THIRDPARTYDIR)
cd $(FREETYPE2DIR) \
&& ./configure \
--prefix='$(THIRDPARTYOUTDIR)' \
--without-png \
PKG_CONFIG='$(PKG_CONFIG)' \
PKG_CONFIG_PATH='$(PKG_CONFIG_PATH)' \
CFLAGS='$(THIRDPARTY_CFLAGS)' \
LDFLAGS='$(THIRDPARTY_LDFLAGS)' \
cp ../third-party/Toolchain-cross-mingw32-cygwin.cmake $(FREETYPE2DIR)
test -d $(FREETYPE2DIR)/build || mkdir $(FREETYPE2DIR)/build
cd $(FREETYPE2DIR)/build \
&& cmake ..\
-DCMAKE_TOOLCHAIN_FILE=../Toolchain-cross-mingw32-cygwin.cmake \
-DCMAKE_INSTALL_PREFIX=$(THIRDPARTYOUTDIR) \
-DWITH_PNG=OFF \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_C_FLAGS="$(THIRDPARTY_CFLAGS)" \
&& make \
&& make install

Expand Down
20 changes: 16 additions & 4 deletions build.win32x86/third-party/Makefile.libgcc
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,23 @@ ifndef THIRDPARTYDIR
include ../common/Makefile.lib.extra
endif

LIBGCCLIBNAME:=libgcc_s_dw2-1.dll
LIBGCCLIBNAME:=libgcc_s_sjlj-1.dll
LIBGCCLIB:=$(THIRDPARTYINSTALLDIR)/$(LIBGCCLIBNAME)
MINGWLIBDIR:=/C/MinGW/bin
MINGWLIBDIR:=/usr/i686-w64-mingw32/sys-root/mingw/bin

$(LIBGCCLIB):
LIBPTHREADLIBNAME:=libwinpthread-1.dll
LIBPTHREADLIB:=$(THIRDPARTYINSTALLDIR)/$(LIBPTHREADLIBNAME)

LIBICONVLIBNAME:=iconv.dll
LIBICONVLIB:=$(THIRDPARTYINSTALLDIR)/$(LIBICONVLIBNAME)

$(LIBGCCLIB): $(LIBICONVLIB) $(LIBPTHREADLIB)
cp -f $(MINGWLIBDIR)/$(LIBGCCLIBNAME) $(THIRDPARTYINSTALLDIR)


$(LIBPTHREADLIB):
cp -f $(MINGWLIBDIR)/$(LIBPTHREADLIBNAME) $(THIRDPARTYINSTALLDIR)

$(LIBICONVLIB):
cp -f $(MINGWLIBDIR)/$(LIBICONVLIBNAME) $(THIRDPARTYINSTALLDIR)

libgcc: $(LIBGCCLIB)
3 changes: 2 additions & 1 deletion build.win32x86/third-party/Makefile.libgit2
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ $(LIBGIT2ARCHIVE):

$(THIRDPARTYLIBDIR)/$(LIBGIT2LIBNAME): $(LIBGIT2ARCHIVE)
tar x -f $(LIBGIT2ARCHIVE) -C $(THIRDPARTYDIR)
cp ../third-party/Toolchain-cross-mingw32-cygwin.cmake $(LIBGIT2DIR)
cd $(LIBGIT2DIR) \
&& cmake \
-DCMAKE_TOOLCHAIN_FILE=./Toolchain-cross-mingw32-cygwin.cmake \
-DCMAKE_INSTALL_PREFIX=$(THIRDPARTYOUTDIR) \
-DUSE_SSH=ON \
-DBUILD_CLAR=OFF \
-DLIBSSH2_FOUND=ON \
-DLIBSSH2_INCLUDE_DIRS=$(THIRDPARTYINCLUDEDIR) \
-DLIBSSH2_LIBRARIES=$(THIRDPARTYLIBDIR)/libssh2-1.dll \
-G "MSYS Makefiles" \
-DCMAKE_C_FLAGS="$(THIRDPARTY_CFLAGS)" \
&& make \
&& make install
Expand Down
11 changes: 6 additions & 5 deletions build.win32x86/third-party/Makefile.libpng
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,22 @@ LIBPNGLIB:=$(THIRDPARTYINSTALLDIR)/$(LIBPNGLIBNAME)
INCDIRS:=$(INCDIRS) $(THIRDPARTYINCLUDEDIR)
EXTRALIBS:=$(EXTRALIBS) $(LIBPNGLIB)
PLUGINREQS:=$(THIRDPARTYLIBS)

$(LIBPNGARCHIVE):
$(WGET) -O $(LIBPNGARCHIVE) $(LIBPNGURL)

$(THIRDPARTYLIBDIR)/$(LIBPNGLIBNAME): $(LIBPNGARCHIVE)
tar x -f $(LIBPNGARCHIVE) -C $(THIRDPARTYDIR)
cd $(LIBPNGDIR) \
&& ./configure --prefix='$(THIRDPARTYOUTDIR)' \
--host=i686-w64-mingw32 \
CFLAGS='$(THIRDPARTY_CFLAGS) -march=pentium4 -I$(THIRDPARTYINCLUDEDIR)' \
CPPFLAGS='$(THIRDPARTY_CFLAGS) -march=pentium4 -I$(THIRDPARTYINCLUDEDIR)' \
LDFLAGS='$(THIRDPARTY_LDFLAGS) -march=pentium4 -L$(THIRDPARTYLIBDIR)' \
&& make \
&& make install
&& make LN=CP LN_S=CP\
&& make install LN=CP LN_S=CP

$(LIBPNGLIB): pkgconfig zlib $(THIRDPARTYLIBDIR)/$(LIBPNGLIBNAME)
cp -f $(THIRDPARTYLIBDIR)/$(LIBPNGLIBNAME) $(THIRDPARTYINSTALLDIR)
libpng: $(LIBPNGLIB)

libpng: $(LIBPNGLIB)
1 change: 1 addition & 0 deletions build.win32x86/third-party/Makefile.libsdl2
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ $(THIRDPARTYLIBDIR)/$(LIBSDL2LIBNAME): $(LIBSDL2ARCHIVE)
tar x -f $(LIBSDL2ARCHIVE) -C $(THIRDPARTYDIR)
cd $(LIBSDL2DIR) \
&& ./configure --prefix='$(THIRDPARTYOUTDIR)' \
--host=i686-w64-mingw32 \
CFLAGS='$(THIRDPARTY_CFLAGS)' \
LDFLAGS='$(THIRDPARTY_LDFLAGS)' \
&& make \
Expand Down
2 changes: 2 additions & 0 deletions build.win32x86/third-party/Makefile.libssh2
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ $(THIRDPARTYLIBDIR)/$(LIBSSH2LIBNAME): $(LIBSSH2ARCHIVE)
tar x -f $(LIBSSH2ARCHIVE) -C $(THIRDPARTYDIR)
cd $(LIBSSH2DIR) \
&& ./configure \
--build=x86_64-w64-cygwin \
--host=i686-w64-mingw32 \
--prefix='$(THIRDPARTYOUTDIR)' \
CFLAGS='$(THIRDPARTY_CFLAGS)' \
LDFLAGS='$(THIRDPARTY_LDFLAGS)' \
Expand Down
3 changes: 2 additions & 1 deletion build.win32x86/third-party/Makefile.openssl
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ $(OPENSSLARCHIVE):

$(THIRDPARTYLIBDIR)/$(OPENSSLLIBNAME): $(OPENSSLARCHIVE)
tar x -f $(OPENSSLARCHIVE) -C $(THIRDPARTYDIR)
sed -i 's/symlink/copy/g' $(OPENSSLDIR)/util/mklink.pl
cd $(OPENSSLDIR) \
&& ./Configure mingw --prefix='$(THIRDPARTYOUTDIR)' shared $(THIRDPARTY_CFLAGS) \
&& CC='$(CC)' LD='$(LD)' NM='$(NM)' RC='$(RC)' DLLTOOL='$(DLLTOOL)' DLLWRAP='$(DLLWRAP)' ./Configure mingw --prefix='$(THIRDPARTYOUTDIR)' shared $(THIRDPARTY_CFLAGS) \
&& make \
&& make install

Expand Down
1 change: 1 addition & 0 deletions build.win32x86/third-party/Makefile.pixman
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ $(THIRDPARTYLIBDIR)/$(PIXMANLIBNAME): $(PIXMANARCHIVE)
cd $(PIXMANDIR) \
&& ./configure \
--prefix='$(THIRDPARTYOUTDIR)' \
--host=i686-w64-mingw32 \
PKG_CONFIG="$(PKG_CONFIG)" \
PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" \
CFLAGS='$(THIRDPARTY_CFLAGS)' \
Expand Down
6 changes: 3 additions & 3 deletions build.win32x86/third-party/Makefile.pkgconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ $(PKGCONFIGARCHIVE):
$(PKGCONFIGBIN): $(PKGCONFIGARCHIVE)
tar x -f $(PKGCONFIGARCHIVE) -C $(THIRDPARTYDIR)
cd $(PKGCONFIGDIR) \
&& ./configure --prefix='$(THIRDPARTYOUTDIR)' --with-internal-glib \
&& make \
&& make install
&& ./configure --prefix='$(THIRDPARTYOUTDIR)' \
&& make LN=cp \
&& make LN=cp install

pkgconfig: $(PKGCONFIGBIN)
1 change: 1 addition & 0 deletions build.win32x86/third-party/Makefile.zlib
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ $(THIRDPARTYLIBDIR)/$(ZLIBLIBNAME): $(ZLIBARCHIVE)
tar x -f $(ZLIBARCHIVE) -C $(THIRDPARTYDIR)
cd $(ZLIBDIR) \
&& make -fwin32/Makefile.gcc \
PREFIX=i686-w64-mingw32- \
CFLAGS='$(THIRDPARTY_CFLAGS)' \
LDFLAGS='$(THIRDPARTY_LDFLAGS)' \
&& make install -fwin32/Makefile.gcc \
Expand Down
17 changes: 17 additions & 0 deletions build.win32x86/third-party/Toolchain-cross-mingw32-cygwin.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)

# which compilers to use for C and C++
SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER i686-w64-mingw32-windres)

# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32 )

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Loading

0 comments on commit b5f5768

Please sign in to comment.