If possible delete the MinGW installation comes in HMG

Creative ideas/suggestions for HMG

Moderator: Rathinagiri

Post Reply
jparada
Posts: 430
Joined: Fri Jan 23, 2009 5:18 pm

If possible delete the MinGW installation comes in HMG

Post by jparada »

Hi,

It will be possible to delete the version of MinGW compiler that comes with the installation of HMG, in the same way also the question is for Harbour, it is possible to delete the installation also comes with HMG.

This in order to have only one installation on my PC, (MinGW and Harbour), now I have two versions on my PC, the versions that I installed and the versions that come with HMG.

This is possible, yes or no?. And please, maybe a little explanation about it.

I await your comments please.

Best Regards
Javier
User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines

Re: If possible delete the MinGW installation comes in HMG

Post by dhaine_adp »

Hi Friend,

I am not so sure if that is possible if you are using HMG-IDE to build your program. Perhaps if you wish to compile your source code using another version of Mingw, you have to build it from dos command window or console window as they call it. Prepare a makefile.gcc and a batch file to compile codes. Also you have to set the path for binaries.

I build harbour source code using Mingw that comes from HMG distribution. Here is a sample of my batch file to set only the path.

1. I created a shortcut for c:\windows\system32\cmd.exe.
2. I modify the target (from the shortcut icon, right click->properties) and changed it to:
%SystemRoot%\system32\cmd.exe /K f:\DAD\BATCHCOMMAND\SETMINGW.BAT
3. the batch file only contain this lines:

Code: Select all

@ECHO OFF
C:
CD\
F:
CD\
set HB_PATH=c:\hmg\harbour
set path=%path%;c:\hmg\mingw\bin;c:\hmg\harbour\bin
@ECHO ON
In your case, simply changed c:\hmg\mingw\bin with c:\mingw\bin (if you installed it on that folder, otherwise put the correct path so that the executables can be found).

4. Here is a sample of my hmgobjects.gcc that I used to build HMG Objects as libhmgobjects.a

Code: Select all

HRB_DIR = c:/hmg/harbour
INC_DIR = c:/hmg/include
OBJ_DIR = f:/dad/hmgobjects/source
LIB_DIR = f:/dad/hmgobjects/source
SRC_DIR = f:/dad/hmgobjects/source

CFLAGS = -Wall -mno-cygwin -O3 

all: \
   $(LIB_DIR)/libhmgobjects.a \

$(LIB_DIR)/libhmgobjects.a : \
   $(OBJ_DIR)/objects.o 

	ar rc $@ $^

$(OBJ_DIR)/objects.o : $(OBJ_DIR)/objects.c

$(OBJ_DIR)/objects.c   : $(SRC_DIR)/objects.prg
	$(HRB_DIR)/bin\harbour.exe $^ -n    -I$(HRB_DIR)/include -i$(INC_DIR) -d__WINDOWS__ -o$@ $^

.prg.c:
	$(HRB_DIR)/bin\harbour.exe $^ -n   -I$(HRB_DIR)/include -i$(INC_DIR) -d__WINDOWS__ -o$@ $^

.c.o:
	gcc $(CFLAGS) -c -I$(INC_DIR) -I$(HRB_DIR)/include -o $@ $^

5. Here is a batch file to call the hmgobjects.gcc

Code: Select all

@echo off

set HmgPath=c:\hmg

Set Path=%HmgPath%\mingw\bin

if "%1" == "clean" goto CLEAN
if "%1" == "CLEAN" goto CLEAN

:BUILD

   mingw32-make.exe -f hmgobjects.gcc
   if errorlevel 1 goto BUILD_ERR

:BUILD_OK

   goto EXIT

:BUILD_ERR

   goto EXIT

:CLEAN
   del *.a
   del *.bak
   del *.o
   del *.c

   goto EXIT

:EXIT

6. Caveats: I don't use the shortcut (from item #1 to #3) if I want to compile HMG codes or programs instead I use the combination of batch file and <makefile>.gcc

If I wanted to build some Harbour contribs from nightly source or from Harbour SVN I used the shortcut and used hbmk2 <compilescript>.hbp if it failed to find the library I just copy it in the current directory try it again. (Sorry, I am not so familiar with the mingw script).

In the end, I resort to creating the gcc script as stated in item #4 and recompile.

Frankly speaking, friend, it is much easier to review working samples from the distribution and deduce the difference and create a script. Well it is frustrating sometime, but when you are able to do what you have intended, you would gain some insight.

Don't delete the mingw installation from hmg, simply rename the folder so that you have a fall back just in case everything didn't turn out right...

But if what I have written here does not help you, I'm sorry and then don't loose hope, in a few days more you would find the solution for sure. Don't let your HMG spirit fades... :)




Regards,

Danny
Regards,

Danny
Manila, Philippines
jparada
Posts: 430
Joined: Fri Jan 23, 2009 5:18 pm

Re: If possible delete the MinGW installation comes in HMG

Post by jparada »

Hi Danny,

Thanks for answering.

Let me take a deep look at what you wrote.

I think that the idea of including MinGW Harbour and the installation of HMG is to make easier the installation of HMG.

In my case and I have an installation of Harbour (which I built from svn), and also because I have to install MinGW, so I would not have twice the same things on my PC.
Danny wrote:But if what I have written here does not help you, I'm sorry...

Please do not even mention it, believe me, any help and advice is valuable only for taking the time to answer.
Danny wrote:Don't let your HMG spirit fades...
Believe me my friend, I try, but ... is difficult sometimes ...

Thanks

Best Regards
Javier
User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines

Re: If possible delete the MinGW installation comes in HMG

Post by dhaine_adp »

Believe me my friend, I try, but ... is difficult sometimes ...
Hi Javier,

I think a much better solution for your problem is to inspect the build.bat from the hmg distribution. You can use that batch file as a template to build your own.

Regards,

Danny
Regards,

Danny
Manila, Philippines
Post Reply