* INSTALL
* GNU Make 3.81 recommended (without 'or upper')
+ Documented GNU Make 3.81.90 bug.
* contrib/make.hbs
* Minor tweak to avoid line ending spaces in stdout.
* Minor visual cleanup.
* contrib/hbide/hbide.hbp
+ Added instfile option to install .dlls on Windows systems.
* config/postinst.hbs
! Fixes in comment and feedback output.
- Deleted commented .hbl generation stuff based on hbmk2.
177 lines
5.8 KiB
Handlebars
177 lines
5.8 KiB
Handlebars
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/*
|
|
* This Harbour script is part of the GNU Make-based build system.
|
|
* WARNING: Running it separately is not supported.
|
|
*
|
|
* Copyright 2009-2010 Viktor Szakats (harbour.01 syenar.hu)
|
|
* See COPYING for licensing terms.
|
|
*/
|
|
|
|
#pragma warninglevel=3
|
|
|
|
/* TOFIX: Ugly hack to avoid #include "directry.ch" */
|
|
#define F_NAME 1 /* File name */
|
|
#define F_ATTR 5 /* File attribute */
|
|
|
|
PROCEDURE Main()
|
|
LOCAL nErrorLevel := 0
|
|
LOCAL cFile
|
|
LOCAL aFile
|
|
|
|
LOCAL tmp
|
|
LOCAL cOldDir
|
|
|
|
LOCAL lContent
|
|
|
|
IF Empty( GetEnv( "HB_PLATFORM" ) ) .OR. ;
|
|
Empty( GetEnv( "HB_COMPILER" ) ) .OR. ;
|
|
Empty( GetEnv( "HB_BIN_INSTALL" ) ) .OR. ;
|
|
Empty( GetEnv( "HB_LIB_INSTALL" ) ) .OR. ;
|
|
Empty( GetEnv( "HB_INC_INSTALL" ) )
|
|
|
|
OutStd( "! Error: This program has to be called from the GNU Make process." + hb_eol() )
|
|
ErrorLevel( 1 )
|
|
RETURN
|
|
ENDIF
|
|
|
|
/* Creating hbmk.hbc */
|
|
|
|
lContent := .F.
|
|
cFile := ""
|
|
cFile += "# hbmk2 configuration" + hb_eol()
|
|
cFile += "# Generated by Harbour build process" + hb_eol()
|
|
cFile += hb_eol()
|
|
|
|
IF GetEnv( "HB_PLATFORM" ) == "dos" .AND. ;
|
|
! Empty( GetEnv( "HB_HAS_WATT" ) )
|
|
cFile += hb_eol()
|
|
cFile += "{dos&djgpp}syslibs=watt" + hb_eol()
|
|
cFile += "{dos&watcom}syslibs=wattcpwf" + hb_eol()
|
|
cFile += "{dos}libpaths=${WATT_ROOT}/lib" + hb_eol()
|
|
lContent := .T.
|
|
ENDIF
|
|
|
|
IF ! Empty( GetEnv( "HB_HAS_GPM" ) )
|
|
cFile += hb_eol()
|
|
cFile += "{" + GetEnv( "HB_PLATFORM" ) + "&" + GetEnv( "HB_COMPILER" ) + "}syslibs=gpm" + hb_eol()
|
|
lContent := .T.
|
|
ENDIF
|
|
|
|
IF lContent
|
|
OutStd( "! Making " + GetEnv( "HB_BIN_INSTALL" ) + hb_ps() + "hbmk.hbc..." + hb_eol() )
|
|
hb_MemoWrit( GetEnv( "HB_BIN_INSTALL" ) + hb_ps() + "hbmk.hbc", cFile )
|
|
ELSE
|
|
FErase( GetEnv( "HB_BIN_INSTALL" ) + hb_ps() + "hbmk.hbc" )
|
|
ENDIF
|
|
|
|
/* Installing some misc files */
|
|
|
|
IF GetEnv( "HB_PLATFORM" ) $ "win|wce|os2|dos" .AND. ;
|
|
! Empty( GetEnv( "HB_INSTALL_PREFIX" ) )
|
|
|
|
OutStd( "! Copying root documents..." + hb_eol() )
|
|
|
|
FOR EACH aFile IN Directory( "Change*" )
|
|
hb_FCopy( aFile[ F_NAME ], GetEnv( "HB_INSTALL_PREFIX" ) + hb_ps() + iif( GetEnv( "HB_PLATFORM" ) == "dos", "CHANGES", aFile[ F_NAME ] ) )
|
|
NEXT
|
|
|
|
hb_FCopy( "COPYING", GetEnv( "HB_INSTALL_PREFIX" ) + hb_ps() + "COPYING" )
|
|
hb_FCopy( "INSTALL", GetEnv( "HB_INSTALL_PREFIX" ) + hb_ps() + "INSTALL" )
|
|
hb_FCopy( "TODO" , GetEnv( "HB_INSTALL_PREFIX" ) + hb_ps() + "TODO" )
|
|
|
|
/* public Harbour scripts */
|
|
FOR EACH tmp IN { "hbxpatch.hbs" }
|
|
hb_FCopy( "bin" + hb_ps() + tmp, GetEnv( "HB_BIN_INSTALL" ) + hb_ps() + tmp )
|
|
NEXT
|
|
ENDIF
|
|
|
|
/* Creating language files */
|
|
|
|
IF ! Empty( GetEnv( "HB_HOST_BIN_DIR" ) )
|
|
|
|
OutStd( "! Making .hbl files..." + hb_eol() )
|
|
|
|
FOR EACH tmp IN Directory( "utils" + hb_ps() + hb_osFileMask(), "D" )
|
|
IF "D" $ tmp[ F_ATTR ] .AND. !( tmp[ F_NAME ] == "." ) .AND. !( tmp[ F_NAME ] == ".." )
|
|
FOR EACH cFile IN Directory( "utils" + hb_ps() + tmp[ F_NAME ] + hb_ps() + "*.po" )
|
|
mk_hb_processRun( PathSepToSelf( GetEnv( "HB_HOST_BIN_DIR" ) ) + hb_ps() + "hbi18n" +;
|
|
" -q -g -o" + PathSepToSelf( GetEnv( "HB_BIN_INSTALL" ) ) + hb_ps() + FN_ExtSet( cFile[ F_NAME ], ".hbl" ) +;
|
|
" " + PathSepToSelf( "utils" + hb_ps() + tmp[ F_NAME ] + hb_ps() + cFile[ F_NAME ] ) )
|
|
NEXT
|
|
ENDIF
|
|
NEXT
|
|
ENDIF
|
|
|
|
/* Creating install packages */
|
|
|
|
IF GetEnv( "HB_PLATFORM" ) $ "win|wce|os2|dos" .AND. ;
|
|
GetEnv( "HB_BUILD_PKG" ) == "yes" .AND. ;
|
|
! Empty( GetEnv( "HB_TOP" ) )
|
|
|
|
tmp := GetEnv( "HB_TOP" ) + hb_ps() + GetEnv( "HB_PKGNAME" ) + ".zip"
|
|
|
|
OutStd( "! Making Harbour .zip install package: '" + tmp + "'" + hb_eol() )
|
|
|
|
FErase( tmp )
|
|
|
|
/* NOTE: Believe it or not this is the official method to zip a different dir with subdirs
|
|
without including the whole root path in filenames; you have to 'cd' into it.
|
|
Even with zip 3.0. For this reason we need absolute path in HB_TOP. There is also
|
|
no zip 2.x compatible way to force creation of a new .zip, so we have to delete it
|
|
first to avoid mixing in an existing .zip file. [vszakats] */
|
|
|
|
cOldDir := hb_ps() + CurDir()
|
|
DirChange( GetEnv( "HB_INSTALL_PREFIX" ) + hb_ps() + ".." )
|
|
|
|
mk_hb_processRun( PathSepToSelf( GetEnv( "HB_DIR_ZIP" ) ) + "zip" +;
|
|
" -q -9 -X -r -o" +;
|
|
" " + FN_Escape( tmp ) +;
|
|
" . -i " + FN_Escape( GetEnv( "HB_PKGNAME" ) + hb_ps() + "*" ) +;
|
|
" -x *.tds -x *.exp" )
|
|
|
|
DirChange( cOldDir )
|
|
|
|
IF GetEnv( "HB_PLATFORM" ) $ "win|wce"
|
|
|
|
tmp := GetEnv( "HB_TOP" ) + hb_ps() + GetEnv( "HB_PKGNAME" ) + ".exe"
|
|
|
|
OutStd( "! Making Harbour .exe install package: '" + tmp + "'" + hb_eol() )
|
|
|
|
mk_hb_processRun( PathSepToSelf( GetEnv( "HB_DIR_NSIS" ) ) + "makensis.exe" +;
|
|
" -V2" +;
|
|
" " + FN_Escape( StrTran( "package/mpkg_win.nsi", "/", hb_ps() ) ) )
|
|
ENDIF
|
|
ENDIF
|
|
|
|
ErrorLevel( nErrorLevel )
|
|
|
|
RETURN
|
|
|
|
STATIC FUNCTION mk_hb_processRun( cCommand )
|
|
|
|
OutStd( cCommand + hb_eol() )
|
|
|
|
RETURN hb_processRun( cCommand )
|
|
|
|
STATIC FUNCTION FN_Escape( cFN )
|
|
RETURN Chr( 34 ) + cFN + Chr( 34 )
|
|
|
|
STATIC FUNCTION FN_ExtSet( cFileName, cExt )
|
|
LOCAL cDir, cName
|
|
|
|
hb_FNameSplit( cFileName, @cDir, @cName )
|
|
|
|
RETURN hb_FNameMerge( cDir, cName, cExt )
|
|
|
|
STATIC FUNCTION PathSepToSelf( cFileName )
|
|
#if defined( __PLATFORM__WINDOWS ) .OR. ;
|
|
defined( __PLATFORM__DOS ) .OR. ;
|
|
defined( __PLATFORM__OS2 )
|
|
RETURN StrTran( cFileName, "/", "\" )
|
|
#else
|
|
RETURN StrTran( cFileName, "\", "/" )
|
|
#endif
|