[Kstars-devel] [kstars] kstars: Make the HTMesh perl module compile, and provide developer instructions

Akarsh Simha akarsh at kde.org
Mon Mar 2 10:30:03 UTC 2015


Git commit cbe9af98e77868b3bcb1f712066990a1965a9e2c by Akarsh Simha.
Committed on 02/03/2015 at 10:29.
Pushed by asimha into branch 'master'.

Make the HTMesh perl module compile, and provide developer instructions

The htmesh library was stripped down heavily in KStars. Therefore, the
perl module would not compile. This commit makes the perl module
compile along with our stripped-down HTMesh library, and also provides
a more helpful README to developers on how to build the perl
module. YMMV.

CCMAIL: kstars-devel at kde.org

M  +10   -24   kstars/data/tools/HTMesh-0.01/HTMesh.xs
M  +25   -23   kstars/data/tools/HTMesh-0.01/README
M  +3    -2    kstars/data/tools/HTMesh-0.01/lib/HTMesh.pm
M  +1    -0    kstars/htmesh/CMakeLists.txt

http://commits.kde.org/kstars/cbe9af98e77868b3bcb1f712066990a1965a9e2c

diff --git a/kstars/data/tools/HTMesh-0.01/HTMesh.xs b/kstars/data/tools/HTMesh-0.01/HTMesh.xs
index a6b6a9b..8af7bd9 100644
--- a/kstars/data/tools/HTMesh-0.01/HTMesh.xs
+++ b/kstars/data/tools/HTMesh-0.01/HTMesh.xs
@@ -7,6 +7,7 @@ extern "C" {
 #ifdef __cplusplus
 }
 #endif
+
 #include "ppport.h"
 
 #include <iostream>
@@ -50,19 +51,19 @@ public:
             delete htm;
         }
 
-        long lookupId(double ra, double dec) {
-             return htm->idByPoint(ra * 15.0, dec);
-        }
+        /* long lookupId(double ra, double dec) { */
+        /*      return htm->idByPoint(ra * 15.0, dec); */
+        /* } */
 
         const char* idToName(long id) {
             htm->nameById(id, name_buffer);
             return name_buffer;
         }
 
-        const char* lookupName(double ra, double dec) {
-            long id = lookupId(ra, dec);
-            return idToName(id);
-        }
+        /* const char* lookupName(double ra, double dec) { */
+        /*     long id = lookupId(ra, dec); */
+        /*     return idToName(id); */
+        /* } */
 
         void intersectCircle(double ra, double dec, double rad) {
             ra = ra * 15.0;
@@ -72,7 +73,7 @@ public:
             convex.add(c); // [ed:RangeConvex::add]
             convex.setOlevel(level);
             range = new HtmRange();
-            convex.intersect(htm, range, false);
+            convex.intersect(htm, range); // commit fec61ac2c400e7138425961e779fed3bbf5687a5 removed unmanipulated bool parameter from RangeConvex::intersect -- asimha
             iterator = new HtmRangeIterator(range);
         }
 
@@ -95,7 +96,7 @@ public:
             RangeConvex* convex = new RangeConvex(corner[0], corner[1], corner[2], corner[3]);
             convex->setOlevel(level);
             range = new HtmRange();
-            convex->intersect(htm, range, false);
+            convex->intersect(htm, range); // commit fec61ac2c400e7138425961e779fed3bbf5687a5 removed unmanipulated bool parameter from RangeConvex::intersect -- asimha
             iterator = new HtmRangeIterator(range);
         }
 
@@ -227,20 +228,6 @@ CODE:
 OUTPUT:
     RETVAL
 
-long
-HTMesh::lookup_id(double ra, double dec)
-CODE:
-    RETVAL = THIS->lookupId(ra, dec);
-OUTPUT:
-    RETVAL
-
-const char*
-HTMesh::lookup_name(double ra, double dec)
-CODE:
-    RETVAL = THIS->lookupName(ra, dec);
-OUTPUT:
-    RETVAL
-
 const char*
 HTMesh::id_to_name(long id)
 CODE:
@@ -248,7 +235,6 @@ CODE:
 OUTPUT:
     RETVAL
 
-
 long
 HTMesh::next_id()
 CODE:
diff --git a/kstars/data/tools/HTMesh-0.01/README b/kstars/data/tools/HTMesh-0.01/README
index c2898cb..12d7f97 100644
--- a/kstars/data/tools/HTMesh-0.01/README
+++ b/kstars/data/tools/HTMesh-0.01/README
@@ -1,40 +1,42 @@
 HTMesh version 0.01
 ===================
 
-The README is used to introduce the module and provide instructions on
-how to install the module, any machine dependencies it may have (for
-example C compilers and installed libraries) and any other information
-that should be provided before the module is installed.
-
-A README file is required for CPAN modules since CPAN extracts the
-README file from a module distribution so that people browsing the
-archive can use it get an idea of the modules uses. It is usually a
-good idea to provide version information here so that people can
-decide whether fixes for the module are worth downloading.
+This Perl HTMesh wrapper was written by James Bowlin based on the
+original HTMesh C++ library (seemingly no longer maintained). After we
+stripped down the HTMesh library for use in KStars (see
+e.g. 0c344a2bf45594e9028f86d6c6a7d5e56b58bdfc -- one of the many
+commits stripping the library down), Akarsh Simha had to modify the
+perl wrapper to reflect these changes.
 
 INSTALLATION
 
-To install this module type the following:
+To install this module, first build the stripped-down HTMesh library
+with -fPIC flag (so it can be used in a shared object), otherwise the
+linker will barf because HTMesh perl library needs to be built as a
+shared object with symbols etc. To do so:
 
-   perl Makefile.PL
-   make
-   make test
-   make install
+   1. Open kstars/kstars/htmesh/CMakeLists.txt and remove the comment
+      on the -fPIC flag.
 
-DEPENDENCIES
+   2. make && make install in the kstars/kstars/htmesh directory
 
-This module requires these other modules and libraries:
+   3. Copy the libhtmesh.a object from the install prefix into
+      /usr/lib or wherever the Makefile below will look for it
+      (alternatively, point the Makefile to it)
 
-  blah blah blah
+   4. Revert the -fPIC uncommenting
 
-COPYRIGHT AND LICENCE
+Then, build the perl module:
+
+   perl Makefile.PL
+   make
+   make test
+   make install # Or sudo make install depending on the prefix etc.
 
-Put the correct copyright and licence information here.
+COPYRIGHT AND LICENCE
 
-Copyright (C) 2006 by A. U. Thor
+Copyright (C) 2015 James Bowlin <bowlin at mindspring.com>, Akarsh Simha <akarsh at kde.org>
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself, either Perl version 5.8.8 or,
 at your option, any later version of Perl 5 you may have available.
-
-
diff --git a/kstars/data/tools/HTMesh-0.01/lib/HTMesh.pm b/kstars/data/tools/HTMesh-0.01/lib/HTMesh.pm
index d2b9ecb..f4a417f 100644
--- a/kstars/data/tools/HTMesh-0.01/lib/HTMesh.pm
+++ b/kstars/data/tools/HTMesh-0.01/lib/HTMesh.pm
@@ -27,8 +27,9 @@ our @EXPORT = qw(
 
 our $VERSION = '0.01';
 
-require XSLoader;
-XSLoader::load('HTMesh', $VERSION);
+use XSLoader;
+
+XSLoader::load 'HTMesh', $VERSION;
 
 # Preloaded methods go here.
 
diff --git a/kstars/htmesh/CMakeLists.txt b/kstars/htmesh/CMakeLists.txt
index 187d59c..8848713 100644
--- a/kstars/htmesh/CMakeLists.txt
+++ b/kstars/htmesh/CMakeLists.txt
@@ -26,6 +26,7 @@ set(HTMesh_LIB_SRCS
 #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
 #TODO is there KF5_ENABLE_EXCEPTIONS?
 set (CMAKE_CXX_FLAGS "-fexceptions")
+#set (CMAKE_CXX_FLAGS "-fPIC") # If you wish to compile the HTMesh perl wrapper, uncomment this, rebuild and copy the library into /usr/lib/, because we will use it as a shared object. See README in th e perl wrapper directory (kstars/kstars/data/tools/HTMesh-*) for more details.
 
 add_library(htmesh STATIC ${HTMesh_LIB_SRCS})
 


More information about the Kstars-devel mailing list