[beports] Re: CMake round twoI'

  • From: "scott mc" <scottmc2@xxxxxxxxx>
  • To: beports@xxxxxxxxxxxxx
  • Date: Thu, 14 Aug 2008 15:59:46 -0700

On Thu, Jun 19, 2008 at 12:53 AM, scott mc <scottmc2@xxxxxxxxx> wrote:
> I'm taking another look at CMake and have make a bunch of
> patches/unpatches for previous BeOS workarounds.  One file though
> needs some help as I don't know what needs to be done here.
> DynamicLoader.cxx, here's the BeOS section from that file, maybe
> someone on the list can look it over and make the changes they think
> it needs for Haiku.
> -scottmc
>
>
> // ---------------------------------------------------------------
> // 4. Implementation for BeOS
> #ifdef __BEOS__
> #include <string.h> // for strerror()
> #include <be/kernel/image.h>
> #include <be/support/Errors.h>
> #define DYNAMICLOADER_DEFINED 1
>
> namespace KWSYS_NAMESPACE
> {
>
> static image_id last_dynamic_err = B_OK;
>
> //----------------------------------------------------------------------------
> DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const char* libname )
> {
>  // image_id's are integers, errors are negative. Add one just in case we
>  //  get a valid image_id of zero (is that even possible?).
>  image_id rc = load_add_on(libname);
>  if (rc < 0)
>    {
>    last_dynamic_err = rc;
>    return 0;
>    }
>
>  return rc+1;
> }
>
> //----------------------------------------------------------------------------
> int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
> {
>  if (!lib)
>    {
>      last_dynamic_err = B_BAD_VALUE;
>      return 0;
>    }
>  else
>    {
>    // The function dlclose() returns 0 on success, and non-zero on error.
>    status_t rc = unload_add_on(lib-1);
>    if (rc != B_OK)
>      {
>      last_dynamic_err = rc;
>      return 0;
>      }
>    }
>
>  return 1;
> }
>
> //----------------------------------------------------------------------------
> DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
>  DynamicLoader::LibraryHandle lib, const char* sym)
> {
>  // Hack to cast pointer-to-data to pointer-to-function.
>  union
>  {
>    void* pvoid;
>    DynamicLoader::SymbolPointer psym;
>  } result;
>
>  result.psym = NULL;
>
>  if (!lib)
>    {
>      last_dynamic_err = B_BAD_VALUE;
>    }
>  else
>    {
>    // !!! FIXME: BeOS can do function-only lookups...does this ever
>    // !!! FIXME:  actually _want_ a data symbol lookup, or was this union
>    // !!! FIXME:  a leftover of dlsym()? (s/ANY/TEXT for functions only).
>    status_t rc = get_image_symbol(lib-1,sym,B_SYMBOL_TYPE_ANY,&result.pvoid);
>    if (rc != B_OK)
>      {
>      last_dynamic_err = rc;
>      result.psym = NULL;
>      }
>    }
>  return result.psym;
> }
>
> //----------------------------------------------------------------------------
> const char* DynamicLoader::LibPrefix()
> {
>  return "lib";
> }
>
> //----------------------------------------------------------------------------
> const char* DynamicLoader::LibExtension()
> {
>  return ".so";
> }
>
> //----------------------------------------------------------------------------
> const char* DynamicLoader::LastError()
> {
>  const char *retval = strerror(last_dynamic_err);
>  last_dynamic_err = B_OK;
>  return retval;
> }
>
> } // namespace KWSYS_NAMESPACE
> #endif
>




Seeing that cmake 2.6.1 was out I took another hack at it yesterday,
the previous patch still worked, only a few lines off in some places
so I made a new patch and posted it.  The build gets fairly far along
in the process but still bombs out when trying to make something in
cmcurl.  It seems like this one is 80-90% there, but it appears to be
over my head at this point.
-scottmc
--
HaikuPorts homepage - http://ports.haiku-files.org
List archives: //www.freelists.org/archives/beports
Administrative contact: brecht@xxxxxxxxxxx

Other related posts: