agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
[Pljava-dev] Building pljava.so with maven-nar-plugin?
10+ messages / 0 participants
[nested] [flat]

* [Pljava-dev] Building pljava.so with maven-nar-plugin?
@ 2013-02-06 01:31  
  0 siblings, 1 reply; 10+ messages in thread

From:  @ 2013-02-06 01:31 UTC (permalink / raw)

Hello

I played around with the maven-nar-plugin that was recommended on this
list. The below pom.xml does produce .h files from the java classes and
also compiles the C files. What's missing though is a way to get a 
.h from "java.sql.Types" as this class is in the JRE's rt.jar and not
in the specified <classDirectory>. Any ideas?

bye,

-christian-

P.S.: Beware the hardcoded paths and Postgres version numbers. Don't
      know yet how to integrate pg_config in maven.

P.P.S.: Directoy layout for the C files is:

	./src/main
	./src/main/c
	./src/main/c/type
	./src/main/include
	./src/main/include/pljava
	./src/main/include/pljava/type


<project
    xmlns="http://maven.apache.org/POM/4.0.0";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd";
<modelVersion>4.0.0</modelVersion> <parent>
        <groupId>org.postgresql</groupId>
        <artifactId>pljava.app</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <artifactId>pljava-so</artifactId>
    <name>pl/java server side library</name>
    <description>Generates the pljava.so library which gets loaded by
the PostgreSQL server.</description> <packaging>nar</packaging>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-nar-plugin</artifactId>
                    <version>2.1-SNAPSHOT</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-nar-plugin</artifactId>
                <extensions>true</extensions>

                <configuration>

                      <javah>
                        <classPaths>
                            <classPath>/srv/home/james/workspace/pljava/lathspell-master/pljava-jdbc/target/classes/</classPath>
                            <classPath>/srv/home/james/workspace/pljava/lathspell-master/pljava-api/target/classes/</classPath>
                        </classPaths>
                        <classDirectory>/srv/home/james/workspace/pljava/lathspell-master/pljava-jdbc/target/classes/</classDirectory>
                        <includes>
                           <include>org/postgresql/**/*.class</include>
                           <include>java/sql/Types.class</include>
                        </includes>
                    </javah>

                    <libraries>
                      <library>
                        <type>shared</type>
                      </library>
                    </libraries>

                    <c>
                        <defines>
                            <define>PKGLIBDIR="target/lib/"</define>
                            <define>PGSQL_MAJOR_VER=9</define>
                            <define>PGSQL_MINOR_VER=2</define>
                            <define>PGSQL_PATCH_VER=0</define>
                        </defines>

                        <includePaths>
                            <includePath>/usr/include/postgresql</includePath>
                            <includePath>/usr/include/postgresql/9.2/server/</includePath>
                            <includePath>src/main/include/</includePath>
                            <includePath>target/nar/javah-include/</includePath>
                        </includePaths>
                    </c>
                </configuration>
            </plugin>
        </plugins>

    </build>
</project>




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Building pljava.so with maven-nar-plugin?
@ 2013-02-06 07:53  
  parent: 
  0 siblings, 1 reply; 10+ messages in thread

From:  @ 2013-02-06 07:53 UTC (permalink / raw)


On 2013-02-06 02:31, Christian Hammers wrote:
> Hello
>
> I played around with the maven-nar-plugin that was recommended on this
> list. The below pom.xml does produce .h files from the java classes and
> also compiles the C files. What's missing though is a way to get a
> .h from "java.sql.Types" as this class is in the JRE's rt.jar and not
> in the specified <classDirectory>. Any ideas?
Not sure why that matters. Executing:

javah java.sql.Types

without giving it a classpath does produce the java_sql_Types.h file 
without problems. Is the current javah configuration deliberately 
stripping off the java runtime?

- thomas


> bye,
>
> -christian-
>
> P.S.: Beware the hardcoded paths and Postgres version numbers. Don't
>        know yet how to integrate pg_config in maven.
>
> P.P.S.: Directoy layout for the C files is:
>
> 	./src/main
> 	./src/main/c
> 	./src/main/c/type
> 	./src/main/include
> 	./src/main/include/pljava
> 	./src/main/include/pljava/type
>
>
> <project
>      xmlns="http://maven.apache.org/POM/4.0.0";
>      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd";
> <modelVersion>4.0.0</modelVersion> <parent>
>          <groupId>org.postgresql</groupId>
>          <artifactId>pljava.app</artifactId>
>          <version>0.0.1-SNAPSHOT</version>
>      </parent>
>      <artifactId>pljava-so</artifactId>
>      <name>pl/java server side library</name>
>      <description>Generates the pljava.so library which gets loaded by
> the PostgreSQL server.</description> <packaging>nar</packaging>
>
>      <build>
>          <pluginManagement>
>              <plugins>
>                  <plugin>
>                      <groupId>org.apache.maven.plugins</groupId>
>                      <artifactId>maven-nar-plugin</artifactId>
>                      <version>2.1-SNAPSHOT</version>
>                  </plugin>
>              </plugins>
>          </pluginManagement>
>
>          <plugins>
>              <plugin>
>                  <groupId>org.apache.maven.plugins</groupId>
>                  <artifactId>maven-nar-plugin</artifactId>
>                  <extensions>true</extensions>
>
>                  <configuration>
>
>                        <javah>
>                          <classPaths>
>                              <classPath>/srv/home/james/workspace/pljava/lathspell-master/pljava-jdbc/target/classes/</classPath>
>                              <classPath>/srv/home/james/workspace/pljava/lathspell-master/pljava-api/target/classes/</classPath>
>                          </classPaths>
>                          <classDirectory>/srv/home/james/workspace/pljava/lathspell-master/pljava-jdbc/target/classes/</classDirectory>
>                          <includes>
>                             <include>org/postgresql/**/*.class</include>
>                             <include>java/sql/Types.class</include>
>                          </includes>
>                      </javah>
>
>                      <libraries>
>                        <library>
>                          <type>shared</type>
>                        </library>
>                      </libraries>
>
>                      <c>
>                          <defines>
>                              <define>PKGLIBDIR="target/lib/"</define>
>                              <define>PGSQL_MAJOR_VER=9</define>
>                              <define>PGSQL_MINOR_VER=2</define>
>                              <define>PGSQL_PATCH_VER=0</define>
>                          </defines>
>
>                          <includePaths>
>                              <includePath>/usr/include/postgresql</includePath>
>                              <includePath>/usr/include/postgresql/9.2/server/</includePath>
>                              <includePath>src/main/include/</includePath>
>                              <includePath>target/nar/javah-include/</includePath>
>                          </includePaths>
>                      </c>
>                  </configuration>
>              </plugin>
>          </plugins>
>
>      </build>
> </project>
>
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at pgfoundry.org
> http://lists.pgfoundry.org/mailman/listinfo/pljava-dev




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Building pljava.so with maven-nar-plugin?
@ 2013-02-07 16:06  
  parent: 
  0 siblings, 2 replies; 10+ messages in thread

From:  @ 2013-02-07 16:06 UTC (permalink / raw)


Am Wed, 06 Feb 2013 08:53:11 +0100
schrieb Thomas Hallgren <thomas at tada.se>:

> 
> On 2013-02-06 02:31, Christian Hammers wrote:
> > Hello
> >
> > I played around with the maven-nar-plugin that was recommended on
> > this list. The below pom.xml does produce .h files from the java
> > classes and also compiles the C files. What's missing though is a
> > way to get a .h from "java.sql.Types" as this class is in the JRE's
> > rt.jar and not in the specified <classDirectory>. Any ideas?
> Not sure why that matters. Executing:
> 
> javah java.sql.Types
> 
> without giving it a classpath does produce the java_sql_Types.h file 
> without problems. Is the current javah configuration deliberately 
> stripping off the java runtime?
> 
> - thomas

The javah target of the maven-nar-plugin only scans a single
<classDirectory> directory for actual *.class files, reads their
method signatures and only adds the class if there is at least one
"native" method. The <includes> parameter does not help here.

I added a <extraClasses> parameter to it that just adds its values
to the end of the javah call and with that it would work.
My pull requests for the maven-nar-plugin are here:
 * https://github.com/maven-nar/maven-nar-plugin/pull/22
 * https://github.com/maven-nar/maven-nar-plugin/pull/21

bye,

-christian-




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Building pljava.so with maven-nar-plugin?
@ 2013-02-07 22:31  
  parent: 
  1 sibling, 0 replies; 10+ messages in thread

From:  @ 2013-02-07 22:31 UTC (permalink / raw)

On 2013-02-07 17:06, Christian Hammers wrote:
> Am Wed, 06 Feb 2013 08:53:11 +0100
> schrieb Thomas Hallgren <thomas at tada.se>:
>
>> On 2013-02-06 02:31, Christian Hammers wrote:
>>> Hello
>>>
>>> I played around with the maven-nar-plugin that was recommended on
>>> this list. The below pom.xml does produce .h files from the java
>>> classes and also compiles the C files. What's missing though is a
>>> way to get a .h from "java.sql.Types" as this class is in the JRE's
>>> rt.jar and not in the specified <classDirectory>. Any ideas?
>> Not sure why that matters. Executing:
>>
>> javah java.sql.Types
>>
>> without giving it a classpath does produce the java_sql_Types.h file
>> without problems. Is the current javah configuration deliberately
>> stripping off the java runtime?
>>
>> - thomas
> The javah target of the maven-nar-plugin only scans a single
> <classDirectory> directory for actual *.class files, reads their
> method signatures and only adds the class if there is at least one
> "native" method. The <includes> parameter does not help here.
>
> I added a <extraClasses> parameter to it that just adds its values
> to the end of the javah call and with that it would work.
> My pull requests for the maven-nar-plugin are here:
>   * https://github.com/maven-nar/maven-nar-plugin/pull/22
>   * https://github.com/maven-nar/maven-nar-plugin/pull/21
>
> bye,
Cool. Let's hope you get those accepted. And thanks for your effort of 
making this happen.

- thomas




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Building pljava.so with maven-nar-plugin?
@ 2013-02-08 00:59  
  parent: 
  1 sibling, 1 reply; 10+ messages in thread

From:  @ 2013-02-08 00:59 UTC (permalink / raw)

Hello

My github fork https://github.com/lathspell/pljava now contains a
directory pljava-so with a pom.xml file that is able to produce a
pljava.so library which works with Postgres 9.2.

Things that are yet to do:
* the linker options slightly differ, e.g. there is a -shared-libgcc
  option that maven adds. Don't know if it hurts.
* the Postgres version is read from a build.properties file. Maybe
  we need an ant task that just calls pg_config and writes it?
  Maybe that properties file would be useful on top-level so that
  e.g. the PGSQL_MAJOR_VERSION accessible by all maven modules?
* The pljava.so is not yet automatically installed
  into /usr/lib/postgres/9.2/lib/ like "make install" would do.
  Probably another ant task needed here?

bye,

-christian-




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Building pljava.so with maven-nar-plugin?
@ 2013-02-11 02:41  
  parent: 
  0 siblings, 1 reply; 10+ messages in thread

From:  @ 2013-02-11 02:41 UTC (permalink / raw)

Hello

My fork (see last mail) has been improved and now calls an ant task that
converts the pg_config output to a properties file which gets then read
by the Maven pom.xml. So no hardcoded version numbers anymore.

"sudo mvn deploy" inside the pljava-so/ directoy now copies the
generated library to /usr/lib/postgres/.../pljava.so.

bye,

-christian-




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Building pljava.so with maven-nar-plugin?
@ 2013-02-11 05:52  
  parent: 
  0 siblings, 1 reply; 10+ messages in thread

From:  @ 2013-02-11 05:52 UTC (permalink / raw)

Hi Christian,

Please submit a pull-request whenever you're happy with it.

- thomas

On 2013-02-11 03:41, Christian Hammers wrote:
> Hello
>
> My fork (see last mail) has been improved and now calls an ant task that
> converts the pg_config output to a properties file which gets then read
> by the Maven pom.xml. So no hardcoded version numbers anymore.
>
> "sudo mvn deploy" inside the pljava-so/ directoy now copies the
> generated library to /usr/lib/postgres/.../pljava.so.
>
> bye,
>
> -christian-
>
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at pgfoundry.org
> http://lists.pgfoundry.org/mailman/listinfo/pljava-dev




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Building pljava.so with maven-nar-plugin?
@ 2013-02-11 14:46  
  parent: 
  0 siblings, 1 reply; 10+ messages in thread

From:  @ 2013-02-11 14:46 UTC (permalink / raw)

Hi

I just did so!

I noticed tough that your repository still has a module "pljava" with
uncompilable Java sources. It seems that I based my repo on the
Hellblazer fork. It's propably better if you go through his commits and
apply them one by one as they contain lots of code changes.

bye,

-christian-

Am Mon, 11 Feb 2013 06:52:58 +0100
schrieb Thomas Hallgren <thomas at tada.se>:

> Hi Christian,
> 
> Please submit a pull-request whenever you're happy with it.
> 
> - thomas
> 
> On 2013-02-11 03:41, Christian Hammers wrote:
> > Hello
> >
> > My fork (see last mail) has been improved and now calls an ant task
> > that converts the pg_config output to a properties file which gets
> > then read by the Maven pom.xml. So no hardcoded version numbers
> > anymore.
> >
> > "sudo mvn deploy" inside the pljava-so/ directoy now copies the
> > generated library to /usr/lib/postgres/.../pljava.so.
> >
> > bye,
> >
> > -christian-
> >
> > _______________________________________________
> > Pljava-dev mailing list
> > Pljava-dev at pgfoundry.org
> > http://lists.pgfoundry.org/mailman/listinfo/pljava-dev
> 
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at pgfoundry.org
> http://lists.pgfoundry.org/mailman/listinfo/pljava-dev



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Building pljava.so with maven-nar-plugin?
@ 2013-02-11 17:34  
  parent: 
  0 siblings, 1 reply; 10+ messages in thread

From:  @ 2013-02-11 17:34 UTC (permalink / raw)

On 2013-02-11 15:46, Christian Hammers wrote:
> Hi
>
> I just did so!
>
> I noticed tough that your repository still has a module "pljava" with
> uncompilable Java sources. It seems that I based my repo on the
> Hellblazer fork. It's propably better if you go through his commits and
> apply them one by one as they contain lots of code changes.
Which of Hellblazers forks did you use? I received (and accepted) a 
pull-request from Hellblazer about a month ago.

- thomas




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* [Pljava-dev] Building pljava.so with maven-nar-plugin?
@ 2013-02-11 18:08  
  parent: 
  0 siblings, 0 replies; 10+ messages in thread

From:  @ 2013-02-11 18:08 UTC (permalink / raw)

I have two repos. The first was my original fork. The one I'm working from is a fork from the official pljava github repo. My fork is https://github.com/Hellblazer/pljava-1

Sent from my Tricorder

On Feb 11, 2013, at 9:34 AM, Thomas Hallgren <thomas at tada.se> wrote:

> On 2013-02-11 15:46, Christian Hammers wrote:
>> Hi
>> 
>> I just did so!
>> 
>> I noticed tough that your repository still has a module "pljava" with
>> uncompilable Java sources. It seems that I based my repo on the
>> Hellblazer fork. It's propably better if you go through his commits and
>> apply them one by one as they contain lots of code changes.
> Which of Hellblazers forks did you use? I received (and accepted) a pull-request from Hellblazer about a month ago.
> 
> - thomas
> 
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at pgfoundry.org
> http://lists.pgfoundry.org/mailman/listinfo/pljava-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20130211/dfbe0ee1/attachment.html;



^ permalink  raw  reply  [nested|flat] 10+ messages in thread


end of thread, other threads:[~2013-02-11 18:08 UTC | newest]

Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-02-06 01:31 [Pljava-dev] Building pljava.so with maven-nar-plugin? 
2013-02-06 07:53 ` 
2013-02-07 16:06   ` 
2013-02-07 22:31     ` 
2013-02-08 00:59     ` 
2013-02-11 02:41       ` 
2013-02-11 05:52         ` 
2013-02-11 14:46           ` 
2013-02-11 17:34             ` 
2013-02-11 18:08               ` 

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox