project-navigation
Personal tools

Author Topic: (log) Actually got new build system to (partially) work on Windows 7  (Read 35614 times)

Offline Muton

  • Sergeant
  • *****
  • Posts: 496
    • View Profile
Re: (log) Actually got new build system to (partially) work on Windows 7
« Reply #30 on: October 13, 2010, 11:22:24 pm »
> i've added a per-target-linker-option. so uforadiant related targets are now linked with g++

Is working like expected

> are there any other changes you've made in order to get that far?

.)shared
mingw32.mk
uforadiant_LDFLAGS       += -lglib-2.0 -lgtk-win32-2.0 -lgobject-2.0 -static-libstdc++
uforadiant-brushexport_LDFLAGS+= -static-libstdc++

.)static
mingw32.mk
uforadiant_LDFLAGS       += -lglib-2.0 -lgtk-win32-2.0 -lgobject-2.0 -static-libstdc++
uforadiant-brushexport_LDFLAGS+= -static-libstdc++
ifeq ($(UNIVERSAL),1)
   PKG_CONFIG            += --static
   ufo_LDFLAGS           += -static
   ufoded_LDFLAGS        += -static
   testall_LDFLAGS       += -static
   ufo2map_LDFLAGS       += -static
   ufomodel_LDFLAGS      += -static
endif
ufo.mk
(needed by smpeg cant be set in mingw32.mk [wrong order {static and shared does work with it}])
$(TARGET)_LDFLAGS  += -lpng  ..... -lstdc++
testall.mk
$(TARGET)_LDFLAGS  += -lcunit ..... -lstdc++


>about w2k, i'll do some research, too (but i can't test here, no w2k)

I'm still able to compile ufo.exe in C::B
C::B is using mingw32-gcc.exe, but using it doesn't solve the problem
Maybe an option .... ???

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: (log) Actually got new build system to (partially) work on Windows 7
« Reply #31 on: October 14, 2010, 07:37:36 am »
is that static-libstdc++ still needed?

the UNIVERSAL stuff is only for mac - to build binaries that run on ppc and i386

the uforadiant ldflags should come from the pkg-config file for gtk - please post the outout of pkg-config --libs gtk-2.0 and pkg-config --libs glib-2.0

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: (log) Actually got new build system to (partially) work on Windows 7
« Reply #32 on: October 14, 2010, 07:38:32 am »
ufo and testall should not need stdc++ at all - they are not c++ but normal c

Offline Muton

  • Sergeant
  • *****
  • Posts: 496
    • View Profile
Re: (log) Actually got new build system to (partially) work on Windows 7
« Reply #33 on: October 14, 2010, 07:20:09 pm »
> is that static-libstdc++ still needed?
yes

> the UNIVERSAL stuff is only for mac
than we need a static option

please post the outout
Code: [Select]
$ pkg-config --libs gtk+-2.0         
-LD:/temp/TMP_CO~2/UFOAIW~1/MinGW/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0
-lgio-2.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0
-lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl 

$ pkg-config --libs glib-2.0
-LD:/temp/TMP_CO~2/UFOAIW~1/MinGW/lib -lglib-2.0 -lintl 

ufo and testall should not need stdc++ at all - they are not c++ but normal c
But smpeg is
if you do a static build
you'll need it
Code: (smpeg) [Select]
./configure --enable-static --enable-shared --prefix= --enable-mmx --disable-gtktest --enable-opengl-player=no --disable-gtk-player CFLAGS="-mms-bitfields $1 -mthreads $2 $3 $4" LDFLAGS="-static-libgcc -static-libstdc++" &&
make CC=g++ CXX=g++ CXXLD='$(CXX) -no-undefined' &&

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: (log) Actually got new build system to (partially) work on Windows 7
« Reply #34 on: October 15, 2010, 07:28:11 am »
please edit build/flags.mk and change the PKG_LIBS macro - add a "--static" there please at the beginning of the call . if that works for you i will add a static option, too

Offline Muton

  • Sergeant
  • *****
  • Posts: 496
    • View Profile
Re: (log) Actually got new build system to (partially) work on Windows 7
« Reply #35 on: October 15, 2010, 08:03:19 pm »
working

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: (log) Actually got new build system to (partially) work on Windows 7
« Reply #36 on: October 16, 2010, 03:06:43 pm »
ok, configure now has a --enable-static option- please try and let me know which modifications you still have

Offline Muton

  • Sergeant
  • *****
  • Posts: 496
    • View Profile
Re: (log) Actually got new build system to (partially) work on Windows 7
« Reply #37 on: October 16, 2010, 06:10:51 pm »
My mod is attached

I've added static a little different than you
and an --enable-w2k switch

We need the -static LDFLAG too ???
added this switch only at mingw32.mk
If you add this to $(TARGET)_LDFLAGS (ufo.mk ufoded.mk ....)
please use this for radiant
$(shell echo $(TARGET_OS) | grep -i "mingw32" >/dev/null || if [ -n "$(STATIC)" ]; then echo -$(STATIC); fi )
Its still not possible in Mingw to build radiant statically

The ufo and ufotest -lstdc++ problem is solved by adding this flag into SDL_mixer.pc
The Windows 2000 problem was caused by CCFLAGS += -std=c99

and please leave the -static-libgcc -static-libstdc++ flags for brush and radiant



Still one problem
stdout and stderr is redirected to
stderr.txt
stdout.txt
for ufomodel and ufo2map



btw. please merge this topic into this one http://ufoai.ninex.info/forum/index.php?topic=4689.0

Offline Muton

  • Sergeant
  • *****
  • Posts: 496
    • View Profile
Re: (log) Actually got new build system to (partially) work on Windows 7
« Reply #38 on: October 17, 2010, 11:10:42 am »
Still one problem
stdout and stderr is redirected to
stderr.txt
stdout.txt
for ufomodel and ufo2map


Is fixed too
As described here
recompiled SDL using --disable-stdio-redirect
removed -mwindows from sdl_config and sdl.pc
ufo2map and ufomodel do now output to stdout and stderr instead of a file
(ufo and testall still compile ;) )


One last very unimportant thing
Do you plan to use the -s switch in the future to reduce the file size?

Offline Muton

  • Sergeant
  • *****
  • Posts: 496
    • View Profile
Re: (log) Actually got new build system to (partially) work on Windows 7
« Reply #39 on: October 17, 2010, 06:07:21 pm »
make pk3
/bin/sh: /bin/7za: Bad file number
make: *** [base/0models.pk3] Error 126

Fist im using 7za instead of 7z (easy fixed)
2nd you append all files as parameters to 7zip
and that will fail
The buffer is not long enough
A listfile is a way arround it
but
For list files, 7-Zip uses UTF-8 encoding by default. You can change encoding using -scs switch
UTF-8
Unicode UTF-8 character set.
WIN
Default character set of Windows.
DOS
Default DOS (OEM) character set of Windows.

7z a archive.7z @listfile.txt -scsWIN

another solution is to hardlink files

or the best solution is a python script (for windows only)
We|I are than able to optimize the pk3 build
because 7z only use 2 cores
On a quad core we can run 2 instances ...

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: (log) Actually got new build system to (partially) work on Windows 7
« Reply #40 on: October 17, 2010, 07:13:32 pm »
i'm only interested in a makefile-only solution and don't want to add extra scripts.

feel free to extend data.mk (the ZIP macro) with 7za, too

Offline mikeg

  • Rookie
  • ***
  • Posts: 24
    • View Profile
Re: (log) Actually got new build system to (partially) work on Windows 7
« Reply #41 on: October 20, 2010, 04:18:22 am »
Hello,

I have a question to this: Is it possible (or generally a good idea) to put dependency task into its own make target to provide a faster build task? Each time I start a incremental build the dependency is recalculated even if I changed nothing on headers.

If it is an own task its up to the programmer to rebuild the dependencies during each build.

Just an opinion.

Regards

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: (log) Actually got new build system to (partially) work on Windows 7
« Reply #42 on: October 20, 2010, 09:30:05 am »
Do you plan to use the -s switch in the future to reduce the file size?

this is done on the make install target - it calls install with the s option for binaries.

but there are also strip targets avaiable - make strip-ufo will only strip the ufo target, make strip will strip everything.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: (log) Actually got new build system to (partially) work on Windows 7
« Reply #43 on: October 20, 2010, 09:30:55 am »
I have a question to this: Is it possible (or generally a good idea) to put dependency task into its own make target to provide a faster build task? Each time I start a incremental build the dependency is recalculated even if I changed nothing on headers.

if you could provide an example what you exactly mean and how to improve it... i will have a look at it.

Offline Muton

  • Sergeant
  • *****
  • Posts: 496
    • View Profile
Re: (log) Actually got new build system to (partially) work on Windows 7
« Reply #44 on: October 23, 2010, 06:27:06 pm »
>> and please leave the -static-libgcc -static-libstdc++ flags for brush and radiant

> can you tell me why this is needed? this isn't needed for cross-compile with mingw-cross-env

You do a static build on mingw-cross-env
that is the reason why you dont need it
But on Windows we still use shared libs
that is the reason why we need it
This parameter wont interfere with a static build (you include it because of -static)
but is is needed for a shared build

===========================================================================

The make pk3 error
can be fixed in to ways


This will force make to use zip on windows instead of 7z or 7za
Why: Because 7z is unable to handle a large parameter list, while zip does its job
This is as slow as usual
but -j3 will help (on a dual core)
Code: (data.mk) [Select]
define ZIP
- $(shell ([ -x "$$(which 7z 2> /dev/null)" -a $(OS) != "Windows_NT" ] && echo "7z a -tzip -mx=9") || ([ -x "$$(which 7z 2> /dev/null)" -a $(OS) != "Windows_NT" ] && echo "7z a -tzip -mx=9") || ([ -x "$$(which zip 2> /dev/null)" ] && echo "zip -u9"))
+ $(shell ([ $$OS != Windows_NT -a -x "$$(which 7z 2> /dev/null)" ] && echo "7z a -tzip -mx=9") || ([ $$OS != Windows_NT -a -x "$$(which 7za 2> /dev/null)" ] && echo "7za a -tzip -mx=9") || ([ -x "$$(which zip 2> /dev/null)" ] && echo "zip -u9"))
endef




This will use the internal search algorithm of 7z and zip to find all files
Its a lot faster, because make.exe dont need to do a lot of string manipulation
Make.exe is slow on windows (single threaded)
Code: (data.mk) [Select]
include build/pk3_def.mk

BASE_DIR = base
PAK_FILES_OUT = $(addprefix $(BASE_DIR)/,$(PAK_FILES))

pk3: $(PAK_FILES_OUT)

clean-pk3:
$(Q)rm -f $(PAK_FILES_OUT)

define FIND
$(shell find $(BASE_DIR)/$(1) -type f -print)
endef

define ZIP
$(shell ([ -x "$$(which 7z 2> /dev/null)" ] && echo "7z u -tzip -mx=9") || ([ -x "$$(which 7za 2> /dev/null)" ] && echo "7za u -tzip -mx=9") || ([ -x "$$(which zip 2> /dev/null)" ] && echo "zip -u9"))
endef

%.pk3 :
ifeq (7z,$(findstring 7z,$(call ZIP)))
   ifeq ($(OS),Windows_NT)
$(Q)cd $(BASE_DIR) ; cmd /c "$(call ZIP) $(filter -r,$(call $@)) $(notdir $@) $(filter-out -r,$(call $@))"
   else
$(Q)cd $(BASE_DIR) ; $(call ZIP) $(filter -r,$(call $@)) $(notdir $@) $(filter-out -r,$(call $@))
   endif
else
$(Q)cd $(BASE_DIR) ; $(call ZIP) $(filter -r,$(call $@)) $(notdir $@) . -i $(subst *,\*,$(filter-out -r,$(call $@)))
endif

define $(BASE_DIR)/0pics.pk3
-r pics/*.jpg pics/*.tga pics/*.png
endef

define $(BASE_DIR)/0textures.pk3
-r textures/*.jpg textures/*.tga textures/*.png
endef

define $(BASE_DIR)/0models.pk3
-r models/*.mdx models/*.md2 models/*.md3 models/*.dpm models/*.obj models/*.jpg models/*.png models/*.tga models/*.anm models/*.tag
endef

define $(BASE_DIR)/0models.pk3
-r models/*.mdx models/*.md2 models/*.md3 models/*.dpm models/*.obj models/*.jpg models/*.png models/*.tga models/*.anm models/*.tag
endef

define $(BASE_DIR)/0snd.pk3
-r sound/*.ogg sound/*.wav
endef

define $(BASE_DIR)/0music.pk3
music/*.ogg
endef

define $(BASE_DIR)/0maps.pk3
-r maps/*.bsp maps/*.ump
endef

define $(BASE_DIR)/0videos.pk3
-r videos/*.roq videos/*.ogm
endef

define $(BASE_DIR)/0media.pk3
media/*.ttf
endef

define $(BASE_DIR)/0shaders.pk3
shaders/*.glsl
endef

define $(BASE_DIR)/0ufos.pk3
-r ufos/*.ufo
endef

define $(BASE_DIR)/0materials.pk3
materials/*.mat
endef

define $(BASE_DIR)/0base.pk3
*.cfg mapcycle.txt irc_motd.txt ai/*.lua
endef