rscdep is dead and gone ... and there was much rejoicing
Change-Id: Id411a6caceaac92d3044fe6a2385d8b1c2f16133
This commit is contained in:
@@ -199,10 +199,6 @@ IMPLIBFLAGS=
|
|||||||
MAPSYM=
|
MAPSYM=
|
||||||
MAPSYMFLAGS=
|
MAPSYMFLAGS=
|
||||||
|
|
||||||
RSC=
|
|
||||||
RSCFLAGS=
|
|
||||||
RSCDEFS=
|
|
||||||
RSCLANG=
|
|
||||||
|
|
||||||
RC=
|
RC=
|
||||||
RCFLAGS=
|
RCFLAGS=
|
||||||
@@ -391,22 +387,6 @@ ENVCFLAGSINCXX*=$(envcflagsincxx)
|
|||||||
ENVLINKFLAGS*=$(envlinkflags)
|
ENVLINKFLAGS*=$(envlinkflags)
|
||||||
.ENDIF
|
.ENDIF
|
||||||
|
|
||||||
.IF "$(envrscflags)"!=""
|
|
||||||
ENVRSCFLAGS*=$(envrscflags)
|
|
||||||
.ENDIF
|
|
||||||
|
|
||||||
.IF "$(envrscdefs)"!=""
|
|
||||||
ENVRSCDEFS*=$(envrscdefs)
|
|
||||||
.ENDIF
|
|
||||||
|
|
||||||
.IF "$(envrsclinkflags)"!=""
|
|
||||||
# ENVRSCLINKFLAGS*=$(envrsclinkflags)
|
|
||||||
.ENDIF
|
|
||||||
|
|
||||||
.IF "$(envrcflags)"!=""
|
|
||||||
ENVRCFLAGS*=$(envrcflags)
|
|
||||||
.ENDIF
|
|
||||||
|
|
||||||
.IF "$(envrclinkflags)"!=""
|
.IF "$(envrclinkflags)"!=""
|
||||||
ENVRCLINKFLAGS*=$(envrclinkflags)
|
ENVRCLINKFLAGS*=$(envrclinkflags)
|
||||||
.ENDIF
|
.ENDIF
|
||||||
@@ -475,8 +455,6 @@ OPTIMIZE=
|
|||||||
|
|
||||||
.INCLUDE : postset.mk
|
.INCLUDE : postset.mk
|
||||||
|
|
||||||
RSC_LANG_ISO+:=$(completelangiso)
|
|
||||||
.EXPORT : RSC_LANG_ISO
|
|
||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
|
|
||||||
@@ -868,12 +846,6 @@ SCPLINKFLAGS=-i $(PAR),$(SOLARPARDIR)
|
|||||||
SCPLINKFLAGS+=-v $(SCPLINKVERSION)
|
SCPLINKFLAGS+=-v $(SCPLINKVERSION)
|
||||||
.ENDIF # "$(SCPLINKVERSION)"!=""
|
.ENDIF # "$(SCPLINKVERSION)"!=""
|
||||||
|
|
||||||
.IF "$(make_srs_deps)"!=""
|
|
||||||
RSC=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/rscdep
|
|
||||||
.ELSE # "$(make_srs_deps)"!=""
|
|
||||||
RSC=$(AUGMENT_LIBRARY_PATH) $(FLIPCMD) $(SOLARBINDIR)/rsc
|
|
||||||
.ENDIF # "$(make_srs_deps)"!=""
|
|
||||||
|
|
||||||
.IF "$(VERBOSE)" == "TRUE"
|
.IF "$(VERBOSE)" == "TRUE"
|
||||||
VERBOSITY=-verbose
|
VERBOSITY=-verbose
|
||||||
.ELSE
|
.ELSE
|
||||||
@@ -884,17 +856,6 @@ RSC=$(AUGMENT_LIBRARY_PATH) $(FLIPCMD) $(SOLARBINDIR)/rsc
|
|||||||
COMPILE_ECHO_SWITCH=
|
COMPILE_ECHO_SWITCH=
|
||||||
COMPILE_ECHO_FILE=$(<:f)
|
COMPILE_ECHO_FILE=$(<:f)
|
||||||
|
|
||||||
RSCFLAGS=-s
|
|
||||||
RSCDEFS=-D$(GUI) -D$(COM) $(JAVADEF)
|
|
||||||
|
|
||||||
RSCDEFIMG*=icon-themes/galaxy
|
|
||||||
|
|
||||||
RSCEXTINC=.
|
|
||||||
|
|
||||||
.IF "$(DEBUG)" != ""
|
|
||||||
RSCDEFS+= -DDEBUG
|
|
||||||
.ENDIF
|
|
||||||
|
|
||||||
# settings for mozilla idl compiler
|
# settings for mozilla idl compiler
|
||||||
XPIDL=xpidl
|
XPIDL=xpidl
|
||||||
XPIDL_LINK=xpt_link
|
XPIDL_LINK=xpt_link
|
||||||
@@ -1062,21 +1023,17 @@ LINKFLAGSADD+= $(LINKFLAGSDEBUG)
|
|||||||
.IF "$(dbgutil)"!=""
|
.IF "$(dbgutil)"!=""
|
||||||
CDEFS+=$(CDEFSDBGUTIL)
|
CDEFS+=$(CDEFSDBGUTIL)
|
||||||
CFLAGS+=$(CFLAGSDBGUTIL)
|
CFLAGS+=$(CFLAGSDBGUTIL)
|
||||||
RSCDEFS+=-DDBG_UTIL
|
|
||||||
.ENDIF
|
.ENDIF
|
||||||
|
|
||||||
.IF "$(product)"!=""
|
.IF "$(product)"!=""
|
||||||
CDEFS+= -DPRODUCT
|
CDEFS+= -DPRODUCT
|
||||||
RSCDEFS+= -DPRODUCT
|
|
||||||
.IF "$(ASSERT_ALWAYS_ABORT)"=="FALSE"
|
.IF "$(ASSERT_ALWAYS_ABORT)"=="FALSE"
|
||||||
CDEFS+=-DNDEBUG
|
CDEFS+=-DNDEBUG
|
||||||
RSCDEFS+= -DNDEBUG
|
|
||||||
.ENDIF
|
.ENDIF
|
||||||
.ENDIF
|
.ENDIF
|
||||||
|
|
||||||
.IF "$(DBG_LEVEL)"!=""
|
.IF "$(DBG_LEVEL)"!=""
|
||||||
CDEFS+=-DOSL_DEBUG_LEVEL=$(DBG_LEVEL)
|
CDEFS+=-DOSL_DEBUG_LEVEL=$(DBG_LEVEL)
|
||||||
RSCDEFS+=-DOSL_DEBUG_LEVEL=$(DBG_LEVEL)
|
|
||||||
.IF "$(DBG_LEVEL)"!="0"
|
.IF "$(DBG_LEVEL)"!="0"
|
||||||
CDEFS+=-DSAL_LOG_INFO -DSAL_LOG_WARN
|
CDEFS+=-DSAL_LOG_INFO -DSAL_LOG_WARN
|
||||||
.ENDIF
|
.ENDIF
|
||||||
@@ -1204,10 +1161,6 @@ CFLAGSCXX+= $(ENVCFLAGSCXX)
|
|||||||
CFLAGSINCXX+:=$(ENVCFLAGSINCXX)
|
CFLAGSINCXX+:=$(ENVCFLAGSINCXX)
|
||||||
LIBFLAGS+= $(ENVLIBFLAGS)
|
LIBFLAGS+= $(ENVLIBFLAGS)
|
||||||
LINKFLAGSADD+= $(ENVLINKFLAGS)
|
LINKFLAGSADD+= $(ENVLINKFLAGS)
|
||||||
RSCFLAGS+= $(ENVRSCFLAGS)
|
|
||||||
RSCDEFS+= $(ENVRSCDEFS)
|
|
||||||
# RSCLINKFLAGS+= $(ENVRSCLINKFLAGS)
|
|
||||||
RCFLAGS+= $(ENVRCFLAGS)
|
|
||||||
RCLINKFLAGS+= $(ENVRCLINKFLAGS)
|
RCLINKFLAGS+= $(ENVRCLINKFLAGS)
|
||||||
|
|
||||||
LINKFLAGSRUNPATH_URELIB*=
|
LINKFLAGSRUNPATH_URELIB*=
|
||||||
|
@@ -1,43 +0,0 @@
|
|||||||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
|
||||||
#
|
|
||||||
# This file is part of the LibreOffice project.
|
|
||||||
#
|
|
||||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
#
|
|
||||||
# This file incorporates work covered by the following license notice:
|
|
||||||
#
|
|
||||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
# contributor license agreements. See the NOTICE file distributed
|
|
||||||
# with this work for additional information regarding copyright
|
|
||||||
# ownership. The ASF licenses this file to you under the Apache
|
|
||||||
# License, Version 2.0 (the "License"); you may not use this file
|
|
||||||
# except in compliance with the License. You may obtain a copy of
|
|
||||||
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
||||||
#
|
|
||||||
|
|
||||||
$(eval $(call gb_Executable_Executable,rscdep))
|
|
||||||
|
|
||||||
$(eval $(call gb_Executable_set_include,rscdep,\
|
|
||||||
-I$(SRCDIR)/tools/bootstrp \
|
|
||||||
-I$(SRCDIR)/tools/inc \
|
|
||||||
$$(INCLUDE) \
|
|
||||||
))
|
|
||||||
|
|
||||||
$(eval $(call gb_Executable_use_libraries,rscdep,\
|
|
||||||
comphelper \
|
|
||||||
sal \
|
|
||||||
tl \
|
|
||||||
$(gb_UWINAPI) \
|
|
||||||
))
|
|
||||||
|
|
||||||
$(eval $(call gb_Executable_use_sdk_api,rscdep))
|
|
||||||
|
|
||||||
$(eval $(call gb_Executable_add_exception_objects,rscdep,\
|
|
||||||
tools/bootstrp/rscdep \
|
|
||||||
tools/bootstrp/cppdep \
|
|
||||||
tools/bootstrp/prj \
|
|
||||||
))
|
|
||||||
|
|
||||||
# vim: set noet sw=4 ts=4:
|
|
@@ -34,7 +34,6 @@ $(eval $(call gb_Module_add_check_targets,tools,\
|
|||||||
ifneq ($(CROSS_COMPILING),YES)
|
ifneq ($(CROSS_COMPILING),YES)
|
||||||
$(eval $(call gb_Module_add_targets,tools,\
|
$(eval $(call gb_Module_add_targets,tools,\
|
||||||
Executable_bestreversemap \
|
Executable_bestreversemap \
|
||||||
Executable_rscdep \
|
|
||||||
))
|
))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@@ -1,217 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
||||||
/*
|
|
||||||
* This file is part of the LibreOffice project.
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
*
|
|
||||||
* This file incorporates work covered by the following license notice:
|
|
||||||
*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed
|
|
||||||
* with this work for additional information regarding copyright
|
|
||||||
* ownership. The ASF licenses this file to you under the Apache
|
|
||||||
* License, Version 2.0 (the "License"); you may not use this file
|
|
||||||
* except in compliance with the License. You may obtain a copy of
|
|
||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <tools/stream.hxx>
|
|
||||||
#include <rtl/strbuf.hxx>
|
|
||||||
#include "cppdep.hxx"
|
|
||||||
|
|
||||||
CppDep::CppDep()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CppDep::~CppDep()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CppDep::Execute()
|
|
||||||
{
|
|
||||||
size_t nCount = m_aSources.size();
|
|
||||||
for ( size_t n = 0; n < nCount; ++n )
|
|
||||||
{
|
|
||||||
const rtl::OString &rStr = m_aSources[n];
|
|
||||||
Search(rStr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sal_Bool CppDep::AddSearchPath( const char* pPath )
|
|
||||||
{
|
|
||||||
m_aSearchPath.push_back( rtl::OString(pPath) );
|
|
||||||
return sal_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
sal_Bool CppDep::AddSource( const char* pSource )
|
|
||||||
{
|
|
||||||
m_aSources.push_back( rtl::OString(pSource) );
|
|
||||||
return sal_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
sal_Bool CppDep::Search(const rtl::OString &rFileName)
|
|
||||||
{
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
fprintf( stderr, "SEARCH : %s\n", rFileName.getStr());
|
|
||||||
#endif
|
|
||||||
sal_Bool bRet = sal_False;
|
|
||||||
|
|
||||||
SvFileStream aFile;
|
|
||||||
rtl::OString aReadLine;
|
|
||||||
|
|
||||||
rtl::OUString suFileName(rtl::OStringToOUString(rFileName, osl_getThreadTextEncoding()));
|
|
||||||
|
|
||||||
aFile.Open( suFileName, STREAM_READ );
|
|
||||||
while ( aFile.ReadLine( aReadLine ))
|
|
||||||
{
|
|
||||||
sal_Int32 nPos = aReadLine.indexOfL(
|
|
||||||
RTL_CONSTASCII_STRINGPARAM("include"));
|
|
||||||
if ( nPos != -1 )
|
|
||||||
{
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
fprintf( stderr, "found : %d %s\n", nPos, aReadLine.getStr() );
|
|
||||||
#endif
|
|
||||||
rtl::OString aResult = IsIncludeStatement( aReadLine );
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
fprintf( stderr, "Result : %s\n", aResult.getStr() );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
rtl::OString aNewFile;
|
|
||||||
if (!aResult.isEmpty())
|
|
||||||
if ( !(aNewFile = Exists( aResult )).isEmpty() )
|
|
||||||
{
|
|
||||||
sal_Bool bFound = sal_False;
|
|
||||||
size_t nCount = m_aFileList.size();
|
|
||||||
for ( size_t i = 0; i < nCount; ++i )
|
|
||||||
{
|
|
||||||
const rtl::OString &rStr = m_aFileList[i];
|
|
||||||
if ( rStr == aNewFile )
|
|
||||||
bFound = sal_True;
|
|
||||||
}
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
fprintf( stderr, "not in list : %d %s\n", nPos, aReadLine.getStr() );
|
|
||||||
#endif
|
|
||||||
if ( !bFound )
|
|
||||||
{
|
|
||||||
m_aFileList.push_back(aNewFile);
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
fprintf( stderr, " CppDep %s\\\n", aNewFile.getStr() );
|
|
||||||
#endif
|
|
||||||
Search(aNewFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
aFile.Close();
|
|
||||||
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
rtl::OString CppDep::Exists(const rtl::OString &rFileName)
|
|
||||||
{
|
|
||||||
char pFullName[1023];
|
|
||||||
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
fprintf( stderr, "Searching %s \n", rFileName.getStr() );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
size_t nCount = m_aSearchPath.size();
|
|
||||||
for ( size_t n = 0; n < nCount; ++n )
|
|
||||||
{
|
|
||||||
struct stat aBuf;
|
|
||||||
const rtl::OString &rPathName = m_aSearchPath[n];
|
|
||||||
|
|
||||||
strcpy( pFullName, rPathName.getStr());
|
|
||||||
strcat( pFullName, DIR_SEP );
|
|
||||||
strcat( pFullName, rFileName.getStr());
|
|
||||||
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
fprintf( stderr, "looking for %s\t ", pFullName );
|
|
||||||
#endif
|
|
||||||
if ( stat( pFullName, &aBuf ) == 0 )
|
|
||||||
{
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
fprintf( stderr, "Got Dependency %s \\\n", pFullName );
|
|
||||||
#endif
|
|
||||||
return rtl::OString(pFullName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rtl::OString();
|
|
||||||
}
|
|
||||||
|
|
||||||
rtl::OString CppDep::IsIncludeStatement(rtl::OString aLine)
|
|
||||||
{
|
|
||||||
sal_Int32 nIndex;
|
|
||||||
|
|
||||||
nIndex = aLine.indexOf("/*");
|
|
||||||
if ( nIndex != -1 )
|
|
||||||
{
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
fprintf( stderr, "found starting C comment : %s\n", aLine.getStr() );
|
|
||||||
#endif
|
|
||||||
aLine = aLine.copy(0, nIndex);
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
fprintf( stderr, "cleaned string : %s\n", aLine.getStr() );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
nIndex = aLine.indexOf("//");
|
|
||||||
if ( nIndex != -1 )
|
|
||||||
{
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
fprintf( stderr, "found C++ comment : %s\n", aLine.getStr() );
|
|
||||||
#endif
|
|
||||||
aLine = aLine.copy(0, nIndex);
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
fprintf( stderr, "cleaned string : %s\n", aLine.getStr() );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
// WhiteSpacesfressen
|
|
||||||
aLine = aLine.replaceAll(rtl::OString(' '), rtl::OString()).
|
|
||||||
replaceAll(rtl::OString('\t'), rtl::OString());
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
fprintf( stderr, "now : %s\n", aLine.getStr() );
|
|
||||||
#endif
|
|
||||||
// ist der erste Teil ein #include ?
|
|
||||||
rtl::OString aRetStr;
|
|
||||||
if (
|
|
||||||
aLine.getLength() >= 10 &&
|
|
||||||
aLine.match(rtl::OString(RTL_CONSTASCII_STRINGPARAM("#include")))
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//#include<foo> or #include"foo"
|
|
||||||
aLine = aLine.copy(9, aLine.getLength()-10);
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
fprintf( stderr, "Gotcha : %s\n", aLine.getStr() );
|
|
||||||
#endif
|
|
||||||
aRetStr = aLine;
|
|
||||||
}
|
|
||||||
return aRetStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef TEST
|
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
|
||||||
{
|
|
||||||
CppDep *pDep = new CppDep();
|
|
||||||
pDep->AddSearchPath(".");
|
|
||||||
pDep->AddSearchPath("/usr/include");
|
|
||||||
pDep->AddSearchPath("/usr/local/include");
|
|
||||||
pDep->AddSearchPath("/usr/include/sys");
|
|
||||||
pDep->AddSearchPath("/usr/include/X11");
|
|
||||||
pDep->Execute();
|
|
||||||
delete pDep;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@@ -1,46 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
||||||
/*
|
|
||||||
* This file is part of the LibreOffice project.
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
*
|
|
||||||
* This file incorporates work covered by the following license notice:
|
|
||||||
*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed
|
|
||||||
* with this work for additional information regarding copyright
|
|
||||||
* ownership. The ASF licenses this file to you under the Apache
|
|
||||||
* License, Version 2.0 (the "License"); you may not use this file
|
|
||||||
* except in compliance with the License. You may obtain a copy of
|
|
||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#define PATH_SEP ":"
|
|
||||||
#define DIR_SEP "/"
|
|
||||||
|
|
||||||
class CppDep
|
|
||||||
{
|
|
||||||
std::vector<rtl::OString> m_aSearchPath;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
std::vector<rtl::OString> m_aFileList;
|
|
||||||
std::vector<rtl::OString> m_aSources;
|
|
||||||
|
|
||||||
sal_Bool Search(const rtl::OString& rFileName);
|
|
||||||
rtl::OString Exists(const rtl::OString& rFileName);
|
|
||||||
|
|
||||||
rtl::OString IsIncludeStatement(rtl::OString aLine);
|
|
||||||
public:
|
|
||||||
CppDep();
|
|
||||||
virtual ~CppDep();
|
|
||||||
virtual void Execute();
|
|
||||||
|
|
||||||
std::vector<rtl::OString>& GetDepList() { return m_aFileList; }
|
|
||||||
sal_Bool AddSearchPath( const char* aPath );
|
|
||||||
sal_Bool AddSource( const char * aSource );
|
|
||||||
};
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@@ -1,58 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
||||||
/*
|
|
||||||
* This file is part of the LibreOffice project.
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
*
|
|
||||||
* This file incorporates work covered by the following license notice:
|
|
||||||
*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed
|
|
||||||
* with this work for additional information regarding copyright
|
|
||||||
* ownership. The ASF licenses this file to you under the Apache
|
|
||||||
* License, Version 2.0 (the "License"); you may not use this file
|
|
||||||
* except in compliance with the License. You may obtain a copy of
|
|
||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "bootstrp/prj.hxx"
|
|
||||||
#include <comphelper/string.hxx>
|
|
||||||
|
|
||||||
SimpleConfig::SimpleConfig(const String &rSimpleConfigFileName)
|
|
||||||
{
|
|
||||||
aFileStream.Open(rSimpleConfigFileName, STREAM_READ);
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleConfig::~SimpleConfig()
|
|
||||||
{
|
|
||||||
aFileStream.Close ();
|
|
||||||
}
|
|
||||||
|
|
||||||
rtl::OString SimpleConfig::getNext()
|
|
||||||
{
|
|
||||||
if (aStringBuffer.isEmpty())
|
|
||||||
while ((aStringBuffer = GetNextLine()) == "\t") ; //solange bis != "\t"
|
|
||||||
if (aStringBuffer.isEmpty())
|
|
||||||
return rtl::OString();
|
|
||||||
|
|
||||||
rtl::OString aString = comphelper::string::getToken(aStringBuffer, 0, '\t');
|
|
||||||
|
|
||||||
aStringBuffer = aStringBuffer.copy(aString.getLength()+1);
|
|
||||||
|
|
||||||
aStringBuffer = comphelper::string::stripStart(aStringBuffer, '\t');
|
|
||||||
|
|
||||||
return aString;
|
|
||||||
}
|
|
||||||
|
|
||||||
rtl::OString SimpleConfig::GetNextLine()
|
|
||||||
{
|
|
||||||
rtl::OString aTmpStr;
|
|
||||||
aFileStream.ReadLine(aTmpStr);
|
|
||||||
if (aTmpStr[0] == '#')
|
|
||||||
return rtl::OString('\t');
|
|
||||||
return aTmpStr.trim().replace(' ', '\t');
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
@@ -1,264 +0,0 @@
|
|||||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
||||||
/*
|
|
||||||
* This file is part of the LibreOffice project.
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
*
|
|
||||||
* This file incorporates work covered by the following license notice:
|
|
||||||
*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed
|
|
||||||
* with this work for additional information regarding copyright
|
|
||||||
* ownership. The ASF licenses this file to you under the Apache
|
|
||||||
* License, Version 2.0 (the "License"); you may not use this file
|
|
||||||
* except in compliance with the License. You may obtain a copy of
|
|
||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef UNX
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "bootstrp/prj.hxx"
|
|
||||||
|
|
||||||
#include <rtl/strbuf.hxx>
|
|
||||||
#include <tools/string.hxx>
|
|
||||||
#include <tools/fsys.hxx>
|
|
||||||
#include <tools/stream.hxx>
|
|
||||||
|
|
||||||
#include "cppdep.hxx"
|
|
||||||
|
|
||||||
class RscHrcDep : public CppDep
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RscHrcDep();
|
|
||||||
virtual ~RscHrcDep();
|
|
||||||
|
|
||||||
virtual void Execute();
|
|
||||||
};
|
|
||||||
|
|
||||||
RscHrcDep::RscHrcDep() :
|
|
||||||
CppDep()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
RscHrcDep::~RscHrcDep()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void RscHrcDep::Execute()
|
|
||||||
{
|
|
||||||
CppDep::Execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
int main( int argc, char** argv )
|
|
||||||
{
|
|
||||||
char aBuf[255];
|
|
||||||
char pFileNamePrefix[255];
|
|
||||||
char pOutputFileName[255];
|
|
||||||
char pSrsFileName[255];
|
|
||||||
String aSrsBaseName;
|
|
||||||
sal_Bool bSource = sal_False;
|
|
||||||
rtl::OStringBuffer aRespArg;
|
|
||||||
// who needs anything but '/' ?
|
|
||||||
sal_Char cDelim = '/';
|
|
||||||
|
|
||||||
RscHrcDep *pDep = new RscHrcDep;
|
|
||||||
|
|
||||||
// When the options are processed, the non-option arguments are
|
|
||||||
// collected at the head of the argv array.
|
|
||||||
// nLastNonOption points to the last of them.
|
|
||||||
int nLastNonOption (-1);
|
|
||||||
|
|
||||||
pOutputFileName[0] = 0;
|
|
||||||
pSrsFileName[0] = 0;
|
|
||||||
|
|
||||||
for ( int i=1; i<argc; i++)
|
|
||||||
{
|
|
||||||
strncpy( aBuf, (const char *)argv[i], sizeof(aBuf) );
|
|
||||||
const sal_Int32 nLength (strlen(aBuf));
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("option %d is [%s] and has length %d\n", i, aBuf, (int)nLength);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (nLength == 0) // Is this even possible?
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (aBuf[0] == '-' && nLength > 0)
|
|
||||||
{
|
|
||||||
bool bIsKnownOption = true;
|
|
||||||
// Make a switch on the first character after the - for a
|
|
||||||
// preselection of the option.
|
|
||||||
// This is faster then multiple ifs and improves readability.
|
|
||||||
switch (aBuf[1])
|
|
||||||
{
|
|
||||||
case 'p':
|
|
||||||
if (nLength > 1 && aBuf[2] == '=' )
|
|
||||||
strcpy(pFileNamePrefix, &aBuf[3]);
|
|
||||||
else
|
|
||||||
bIsKnownOption = false;
|
|
||||||
break;
|
|
||||||
case 'f':
|
|
||||||
if (nLength > 2 && aBuf[2] == 'o' && aBuf[3] == '=' )
|
|
||||||
strcpy(pOutputFileName, &aBuf[4]);
|
|
||||||
else if (nLength>2 && aBuf[2] == 'p' && aBuf[3] == '=' )
|
|
||||||
{
|
|
||||||
strcpy(pSrsFileName, &aBuf[4]);
|
|
||||||
String aName( pSrsFileName, osl_getThreadTextEncoding());
|
|
||||||
DirEntry aDest( aName );
|
|
||||||
aSrsBaseName = aDest.GetBase();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
bIsKnownOption = false;
|
|
||||||
break;
|
|
||||||
case 'i':
|
|
||||||
case 'I':
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
printf("Include : %s\n", &aBuf[2] );
|
|
||||||
#endif
|
|
||||||
pDep->AddSearchPath( &aBuf[2] );
|
|
||||||
break;
|
|
||||||
case 'h' :
|
|
||||||
case 'H' :
|
|
||||||
case '?' :
|
|
||||||
printf("RscDep 1.0\n");
|
|
||||||
break;
|
|
||||||
case 'a' :
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
printf("option a\n");
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'l' :
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
printf("option l with Value %s\n", &aBuf[2] );
|
|
||||||
#endif
|
|
||||||
pDep->AddSource(&aBuf[2]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
bIsKnownOption = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
if ( ! bIsKnownOption)
|
|
||||||
printf("Unknown option error [%s]\n", aBuf);
|
|
||||||
#else
|
|
||||||
(void)bIsKnownOption;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if (aBuf[0] == '@' )
|
|
||||||
{
|
|
||||||
rtl::OString aToken;
|
|
||||||
String aRespName( &aBuf[1], osl_getThreadTextEncoding());
|
|
||||||
SimpleConfig aConfig( aRespName );
|
|
||||||
while (!(aToken = aConfig.getNext()).isEmpty())
|
|
||||||
{
|
|
||||||
char aBuf2[255];
|
|
||||||
strcpy( aBuf2, aToken.getStr());
|
|
||||||
if ( aBuf[0] == '-' && aBuf[1] == 'p' && aBuf[2] == '=' )
|
|
||||||
{
|
|
||||||
strcpy(pFileNamePrefix, &aBuf[3]);
|
|
||||||
}
|
|
||||||
if ( aBuf2[0] == '-' && aBuf2[1] == 'f' && aBuf2[2] == 'o' )
|
|
||||||
{
|
|
||||||
strcpy(pOutputFileName, &aBuf2[3]);
|
|
||||||
}
|
|
||||||
if ( aBuf2[0] == '-' && aBuf2[1] == 'f' && aBuf2[2] == 'p' )
|
|
||||||
{
|
|
||||||
strcpy(pSrsFileName, &aBuf2[3]);
|
|
||||||
String aName( pSrsFileName, osl_getThreadTextEncoding());
|
|
||||||
DirEntry aDest( aName );
|
|
||||||
aSrsBaseName = aDest.GetBase();
|
|
||||||
}
|
|
||||||
if (aBuf2[0] == '-' && aBuf2[1] == 'i' )
|
|
||||||
{
|
|
||||||
pDep->AddSearchPath( &aBuf2[2] );
|
|
||||||
}
|
|
||||||
if (aBuf2[0] == '-' && aBuf2[1] == 'I' )
|
|
||||||
{
|
|
||||||
pDep->AddSearchPath( &aBuf2[2] );
|
|
||||||
}
|
|
||||||
if (( aBuf2[0] != '-' ) && ( aBuf2[0] != '@' ))
|
|
||||||
{
|
|
||||||
pDep->AddSource( &aBuf2[0] );
|
|
||||||
aRespArg.append(' ').append(&aBuf2[0]);
|
|
||||||
bSource = sal_True;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Collect all non-options at the head of argv.
|
|
||||||
if (++nLastNonOption < i)
|
|
||||||
argv[nLastNonOption] = argv[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String aCwd(pFileNamePrefix, osl_getThreadTextEncoding());
|
|
||||||
SvFileStream aOutStream;
|
|
||||||
String aOutputFileName( pOutputFileName, osl_getThreadTextEncoding());
|
|
||||||
DirEntry aOutEntry( aOutputFileName );
|
|
||||||
String aOutPath = aOutEntry.GetPath().GetFull();
|
|
||||||
|
|
||||||
String aFileName( aOutPath );
|
|
||||||
aFileName += cDelim;
|
|
||||||
aFileName += aCwd;
|
|
||||||
aFileName += String(".", osl_getThreadTextEncoding());
|
|
||||||
aFileName += aSrsBaseName;
|
|
||||||
aFileName += String(".dprr", osl_getThreadTextEncoding());
|
|
||||||
aOutStream.Open( aFileName, STREAM_WRITE );
|
|
||||||
|
|
||||||
// Process the yet unhandled non-options. These are supposed to
|
|
||||||
// be names of files on which the target depends.
|
|
||||||
rtl::OStringBuffer aString;
|
|
||||||
if ( nLastNonOption >= 0 )
|
|
||||||
{
|
|
||||||
#ifdef DEBUG_VERBOSE
|
|
||||||
printf("further arguments : ");
|
|
||||||
#endif
|
|
||||||
aString.append(rtl::OString(pSrsFileName).replace('\\', cDelim));
|
|
||||||
aString.append(RTL_CONSTASCII_STRINGPARAM(" : " ));
|
|
||||||
|
|
||||||
for (sal_Int32 nIndex=0; nIndex<=nLastNonOption; ++nIndex)
|
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("option at %d is [%s]\n", (int)nIndex, argv[nIndex]);
|
|
||||||
#endif
|
|
||||||
if (!bSource )
|
|
||||||
{
|
|
||||||
aString.append(' ');
|
|
||||||
aString.append(argv[nIndex]);
|
|
||||||
pDep->AddSource(argv[nIndex]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
aString.append(aRespArg.makeStringAndClear());
|
|
||||||
pDep->Execute();
|
|
||||||
std::vector<rtl::OString>& rLst = pDep->GetDepList();
|
|
||||||
size_t nCount = rLst.size();
|
|
||||||
if ( nCount != 0 )
|
|
||||||
aString.append('\\');
|
|
||||||
aOutStream.WriteLine( aString.makeStringAndClear() );
|
|
||||||
|
|
||||||
for ( size_t j = 0; j < nCount; ++j )
|
|
||||||
{
|
|
||||||
rtl::OStringBuffer aStr(rLst[j].replace('\\', cDelim));
|
|
||||||
if ( j != (nCount-1) )
|
|
||||||
aStr.append('\\');
|
|
||||||
aOutStream.WriteLine(aStr.makeStringAndClear());
|
|
||||||
}
|
|
||||||
delete pDep;
|
|
||||||
aOutStream.Close();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
Reference in New Issue
Block a user