How did I manage to compile openoffice under win32 with 
hungarian language included?

First of all, what did I use:

OpenOffice.org 641d source file

outlang-034/sorted.txt.gz from
http://office.fsf.hu/work/sourcefiles/
for the hungarian language

Microsoft Visual C++ (Visual Studio 6, egyetemi licensz) + SP3
(Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for
80x86)

Windows XP Professional (egyetemi licensz!)

Cygnus Cygwin corretly installed.
 Versions:
interesting:

bison 1.34-1
flex 2.5.4-1

not interesting versions:
unzip 5.41-1
zip 2.3-1
bash 2.05a-3
gawk 3.0.4-1
fileutils 4.1
cygwin 1.3.10-1
tar 1.13.19-1
autoconf 2.53
automake 1.6a
binutils 20011002
gcc 2.95.3
make 3.79
perl 5.6.1-2
cygutils 1.0.0

Other programs:
unz550xN.exe (unzip)
zip23xN.zip (zip)
STLport-4.0.tar.gz

magyarispell:
hu_HU0.65.zip

gpc231.zip
ActivePerl-5.6.1.631-MSWin32-x86.msi
(msi installer from office xp)

4nt401.exe
(4NT shell)

JDK1.3.1_01

microsoft macro assembler:
ml 6.11d
from
64baaed47692834cc7ba9fbb2cc44393 *98SETUP.EXE
de12f1caec6550b14d0ccb4e7c0e9f6a *BINS_DDK.EXE


Base documents:
http://l10n.openoffice.org/adding_language.html
http://www.openoffice.org/dev_docs/source/build_windows.html

1.) Adding new language

To add new language, follow the document:
 http://l10n.openoffice.org/adding_language.html
My changes:
export.hxx.diff
postset.mk.diff

To insert hungarian dictionary I tried (not working!):
dictionary.lst.diff
files_lingu.scp.diff
Linguistic.xcd.diff
module_lingu.lng.diff
myspell_makefile.mk.diff


To add language resources to .src files, use the following command:
localize -m -i hu-HU -l 36 -f outlang-hun...
(I tell You later, how to make 'localize.exe', see below)
This patch had errors on the following files:

sch_source_ui_app_menuids.src
sd_source_ui_dlg_paragr.src
sw_source_ui_chrdlg_swbreak.src
sw_source_ui_inc_swmn.hrc
taborder.src

There are repaired by hand.

The compilation begins with unpacking the source code after successfully 
installing  all the other required softwares.
unpacking is easy, simply "tar xfvz oo_641d_src.tar.gz".
Under windows this puts errors with uid problems, this is because the tar
file contains definitions about user rights on files. This should be ok.

Compiling openoffice is done by running build or dmake command. This commands 
read the neccessary makefiles, and run the compiler, linking and other 
commands.

Dmake is a utility which can be compilied alone, but it is included in the
source. But first of all: to compile the whole stuff, You will need some
customization about directories in the enviromnemt variables.
So:
cd oo_641d_src/config_office
(this will be the SRC_ROOT directory!!)
copy makefile.rc ../makefile.mk
copy winenvsample.bat ../winenv.bat 
(You can download my (sample) modified winenv.bat too).

This step can be substituted by running 
"bash configure" in config_office directory. I do not prefer this one: 
It did not make a working winenv.bat, so modify winenv manually!

Important remarks in winenv.bat:
winenv.bat contains:
rem     STLPORT4   - Absolute path to your STLport 4.0 installation
rem                  directory, for example C:\STLport-4.0
rem                  if set to NO_STLPORT, then the stlport version
rem                  provided with the source is build

STLport is a library which is also included in the openoffice source, but 
You can download and compile Your own too. 
1. I had problems with stlport 4.5 which was compiled by me outside the
openoffice project. I think I've seen somewhere a variable "stlport_version",
maybe this helps, but You should use 4.0. 
2.
On the other hand, stlport 4.0 is included in the source code, BUT
STLPORT4=NO_STLPORT (as described above) is NOT working, You should set
it to NO_STLPORT4. This also do _not_ work. If You set this variable to
no_stlport, then the system does _not_ compile stlport and it won't find it.
If you set it to no_stlport4, then during the dmake process, You'll see
compilation errors. It is because it appends -INO_STLPORT4/... compilation 
options. This is bad, It should have been something like 
-Ic:\oo_641_src\stlport\something. So, prefer building Your own stlport!

Building stlport:
tar xfvz stlport.....tgz
cd stlport  (This will be the "STLPORT4" directory!)
(read INSTALL)
cd src
copy vc6.mak makefile
nmake all
(nmake is part of visual studio)
You don't need to install it.
( Remark: STLport 4.5 (which is unusable!) made stlport_vc645.dll 
in the stlport\lib directory, but openoffice searches for stlport_vc6.dll. )

OK, You have STLport, let's go on. You will need dmake to build anything.
dmake can be found in $SRC_ROOT/dmake directory, but as source code, not
as dmake.exe, so You have to compile it. If You set correct values in
winenv.bat, then (You will see later) winenv.bat compiles dmake.exe when
You start it. I found that this has some problems, so prefer compiling it
by yourself.

cd dmake
make.bat win95-vpp40

If everything went o.k. , You will be able to find a dmake.exe 
( 7a8077332a935bcd483df9cb5fd6fd80 *dmake.exe, 143360 bytes) in the directory
($SRC_ROOT/dmake.exe)
I do not remember, maybe this command should be run in the 4nt shell!
If You do _not_ find dmake.exe after compilation , try this make.bat command
from bash or 4nt shell!

The other program which is used while compiling openoffice.org is build.
This is an alias of perl %SOLARENV\bin\build.pl product=full

Perl is set in winenv.bat, I used the activeperl, not the cygnus perl.
(set PERL_PATH=i:\perl\bin)

Let's see the beginning of winenv.bat:
set SRC_ROOT=g:\openoffice\source\oo_641d_src
set JAVA_HOME=i:\jdk1.3.1_01
set PERL_PATH=i:\perl\bin
set STLPORT4=g:\openoffice\stlport
(rem NO_STLPORT4)
set ASM_PATH=i:\util
set UNZIP_PATH=i:\util
set COMPATH=I:\progra~1\micros~3\vc98
set CYGWIN=i:\cygwin\bin

COMPATH is the path for visual studio. It should be set in 8.3 dos format,
as You can see. (How do You know which "micros~?" is the right? Download a 
free Volkov commander, this is working in 16 bit mode, so search for the
 right directory and You will know the "16bit" name ...)

Openoffice.org had problems with my sp3 visual studio, it did not 
recognize my cl version. 
Changes should be done in th_compv.patch (solenv/inc/tg_compv.mk):
 .IF "$(COM)"=="MSC"
-.IF "$(CCNUMVER)">="001200000000"
+#.IF "$(CCNUMVER)">="001200000000"
 COMID=MSC
 COMNAME=msci
-.ENDIF
+#.ENDIF
 .ENDIF


So You now have a working dmake.exe, an installed stlport, a configured
winenv.bat, what else?
You have to set 4NT shell variables. 
http://www.openoffice.org/dev_docs/source/build_windows.html
Tells You should set

[4NT]
CommandSep = ^
EscapeChar = Ctrl-X
ParameterChar = &
LocalAliases = Yes

in the 4nt.ini file. It is not fully correct. This variables can be set
in eighter the 4nt.ini file, but You can also set in the menu of 4NT, 
run 4nt, and type "option" (enter).

The problem with these settings is "CommandSep". If You set 
CommandSep to "^" then the system cannot unpack some files.
dmake tries to run something like:
"cd directory && gunzip -c something && tar -xvf - && cd .."
To run this correctly You should set CommandSep to "&".
(One sample to check if it is ok: echo a && echo b | cat && echo c
 will give You "a(\n)b(\n)c", but setting CommandSep to "^" will lead to
errors (cat does not finds file " && echo c" )) 

Ok, let's set CommandSep to "^". This is also not workable: 
winenv.bat contains:

if not exist %SRC_ROOT\dmake\dmake.exe (cd %SRC_ROOT\dmake ^ call make.bat
 win95-vpp40 ^ cd %SRC_ROOT)

This won't work if You set CommandSep to "^".
If You build dmake.exe manually as I described above, then CommandSep "&" 
will be o.k., if not, then You should run winenv.bat with commandset ^ and
then change it to & and run winenv.bat again.

The whole build process is done by typing "dmake" in $SRC_ROOT.
If the dmake process stops somewhere, You should do the followings:
For example You had problems in "scp" directory. 
Type "cd scp"
In this directory You will find a directory "wntmsci7.pro". This directory
is where the build process puts the output file. You can simply delete this
whole directory if You feel that it might contain bad files, build will
remake this directory (structure).
After building files in wntmsci7.pro directory, the dmake process copies the
neccessary files to $SRC_ROOT/solver/641/wntmsci7.pro/(bin,idl...) 
directories. 
After dmake successfully builds all sub-projects in the different 
directories, it will build the install files in the directory
instsetoo/wntmsci7.pro directory. The hungarian version will be found in
the directory instsetoo/wntmsci7.pro/36. (exactly 36/normal)
To make this You should also set "set RES_HUNG=TRUE" in the winenv.bat file.
(Or use my winenv.bat ... )

Okay, You have the right utilities and You know something about the build 
process, but You cannot insert the hungarian language tags in the code. 
How to make localize.exe? Localize.exe will be built in transex3 directory
Run 4NT shell.
type
winenv.bat
cd transex3
build
This will make $SRC_ROOT/transex3/wntmsci7.pro/bin/localize.exe
Finally this will be copied to 
$SRC_ROOT/solver/641/wntmsci7.pro/bin/localize.exe.
Running a right 4nt shell it might find this binary, but You can simply copy
localize.exe in the $SRC_ROOT directory. Now You can now run localize.exe:
localize -m -i hu-HU -l 36 -f outlang...txt

(I used the outlang-034-sorted.txt file, which contains
references to hungarian tags as '99' (external) language. I wanted to
use this file as '36' resources, so I converted them to the '36' format
by a simple perl script:
lang9936.pl:
while ($sor=<>)
{
@s=split("\t",$sor);
#print $s[9]."\n";
$s[9]=36;
$sor2=join("\t",@s);
print $sor2;
}
(then perl lang9936.pl outlang-034-sorted >outlang-034-sorted_99.txt)


Now You have everything to start compilation, but the source tree has
some problems...

STLport and visual c++ header files (#include windows.h) are incompatible
in min() and max() functions. You should insert 
#ifndef NOMINMAX
#define NOMINMAX        // Prevent Windows from #defining min/max
#endif // NOMINMAX
in the file 
connectivity/source/drivers/ado/AStatement.cxx 
(You can find the diff files ...)

bison 1.34 did not run correctly
th_yxx.mk in solenv/inc should be changed. My sample change is:
@@ -3,10 +3,14 @@
 $(YACCTARGET): $(YACCFILES)
        @echo ------------------------------
        @echo Making: $@
-       $(BISON) $(YACCFLAGS) $(YACCTARGET) $(YACCFILES)
-# removing -f switch - avoid getting nothing when copying a file to itself
-       @+-$(COPY:s/-f//) $@.h $(INCCOM)$/$(@:b).hxx >& $(NULLDEV)
+        $(BISON) -d -y $(YACCFILES)
+        mv y.tab.c $(YACCTARGET)
+       @+-$(COPY:s/-f//) y.tab.h $(INCCOM)$/$(@:b).hxx >& $(NULLDEV)
        @+-$(COPY:s/-f//) $(@:d)$/$(@:b).hxx $(INCCOM)$/$(@:b).hxx >& $(NULLDEV)
-       +$(TYPE) $(INCCOM)$/$(@:b).hxx >& $(NULLDEV)
+#      $(BISON) $(YACCFLAGS) $(YACCTARGET) $(YACCFILES)
+# removing -f switch - avoid getting nothing when copying a file to itself
+#      @+-$(COPY:s/-f//) $@.h $(INCCOM)$/$(@:b).hxx >& $(NULLDEV)
+#      @+-$(COPY:s/-f//) $(@:d)$/$(@:b).hxx $(INCCOM)$/$(@:b).hxx >& $(NULLDEV)
+#      +$(TYPE) $(INCCOM)$/$(@:b).hxx >& $(NULLDEV)
 .ENDIF

Why? bison -d -o outfile.hxx infile.yy tries to make a ".c" and a ".c.h" file.
It does not recognize .hxx, so it simply tries to make a ".hxx" and another
".hxx" file, but these should be different. My changes simply drop 
-o option, and put -y option instead. No bison makes y.tab.c and y.tab.h,
which should be moved to the appropiate target.

Other changes in idlc/source/makefile.mk (also bison problem):

-YACCTARGET=$(MISC)$/parser.cxx
-YACCFILES=parser.yy
 OBJFILES=   \
                        $(OBJ)$/scanner.obj     \
@@ -137,6 +135,10 @@
 .INCLUDE :  target.mk
+$(MISC)$/parser.cxx: parser.yy
+        +bison -v -d -o$(MISC)$/parser.cxx parser.yy
+        +$(COPY) $(MISC)$/parser.hxx $(OUT)$/inc$/parser.hxx
+
 $(MISC)$/stripped_scanner.ll : scanner.ll
 .IF "$(GUI)"=="WNT"

Another bison problem connectivity/source/parse/makefile.mk
(I do not include this here, but you can download it as diff file)

Okay, bison problems solved, what else?
4NT is not cygnus bash, I had problems with some symlinks.
"awk.exe" is a symlink under cygnus to gawk.exe
"gunzip.exe" is a symlink under cygnus to gzip.exe
These files cannot be run correctly from 4NT shell.
The trivial solution (workaround) is to overwrite awk.exe (symlink) 
witch gawk.exe, and gunzip.exe with gzip.exe.
(not doing this will lead to compilation errors in sablot directory)

If the build is successfully done, You might find that the hungarian
version can be easily installed, but the openoffice (soffice.exe) hangs
at start. The reason is a missing resource file in the
oo/program/resource directory, the missing file is iso64136.res.
Why is it missing? The installer has some definitions about what should
be copied and to where. This is done by some code in the $SRC_ROOT/scp
directory.

There are problems with player.scp and gcfg.inc. This files do not
contain references to tags with number '36' (hungarian), so the whole
build process does not work, only for the english version. If You
correctly insert the tags in these files, then the build will be o.k.,
but the system does not copy the iso... resource file.
The bug is in the scp/source/office/basic.scp:
-    countrynumber = 19
+    countrynumber = 20

     dim countrystrings(countrynumber) as String

@@ -473,6 +473,7 @@
     countrystrings(17) = "90"
     countrystrings(18) = "96"
     countrystrings(19) = "99"
+    countrystrings(20) = "36"

After changing this, the system will copy the iso resource file to the
right place. Some info about the structure of the installer: All the
installer files (f_0001 and so on) are simple .zip files, so You can
easily check what's inside with 
bash for i in * ; do unzip -v $i; done

files: http://www.ebizlab.hit.bme.hu/~boldi/openoffice/ford1

boldi@mail2002.etl.hu