# Creating a new port; NetRexx



## Deleted member (Feb 1, 2020)

Makefile

```
# $FreeBSD$

PORTNAME=    NetRexx
DISTVERSION=    3.08
PORTVERSION=    1
CATEGORIES=    java
MASTER_SITES=    http://www.netrexx.org/
DISTNAME=    NetRexx

MAINTAINER=    ports@FreeBSD.org
COMMENT=    NetRexx is a general-purpose programming language inspired by two very different programming languages, Rexx and Java.

LICENSE=    ICU
LICENSE_FILE=    ${WRKSRC}/LICENSE
LICENSE_PERMS=    auto-accept
LICENSE_NAME=    LICENSE

NO_BUILD=    yes
USES=        zip
USE_JAVA=    yes
JAVA_VERSION=     1.8

.include <bsd.port.mk>
```
distinfo

```
TIMESTAMP = 1580589290
SHA256 (NetRexx.zip) = 216bc84172661a3c2576108dea9db7dd9a6163392ceb45dde58edcd98b17f821
SIZE (NetRexx.zip) = 16214952
```
pkg-descr

```
NetRexx is a general-purpose programming language inspired by two very different programming languages, Rexx and Java. It is designed for people, not computers. In this respect it follows Rexx closely, with many of the concepts and most of the syntax taken directly from Rexx or its object oriented version, Object Rexx. From Java it derives static typing, binary arithmetic, the object model, and exception handling. "A smart language designed for real people, and vice versa." Originally a product from the IBM Hursley Software Lab, NetRexx has always been free software and is free and open source since June 11, 2011. It is the first alternative language for the Java Virtual Machine (JVM).

Why NetRexx?
* NetRexx makes programming easy, and fun again
* The Rexx type, combining numeric and string processing in one class
* Unlimited precision arithmetic built into the language
* Interpret your code or compile to JVM .class files
* Lightning fast performance compared to other JVM scripting languages
* Seamless integration to all JVM libraries
* Built-in luxurious parsing and tracing

NOTE: Remember to add NetRexxC.jar to your Java CLASSPATH.

WWW: http://www.netrexx.org
```

The distinfo was created with `make makesum`, but when I run `make makeplist` I get:

```
===>  Staging for NetRexx-3.08
===>   NetRexx-3.08 depends on file: /usr/local/openjdk8/bin/java - found
===>   Generating temporary packing list
make[1]: cannot open Makefile.

make[1]: stopped in /usr/ports/java/netrexx/work/NetRexx
*** Error code 2

Stop.
make: stopped in /usr/ports/java/netrexx
```
Obviously since this is my first port, I am doing something wrong.  Everything in the zip file can be installed to /usr/local/netrexx.


----------



## George (Feb 2, 2020)

I think `make` complains that it cannot locate a Makefile in ${WRKSRC}.

Also, your Makefile kind of lacks a "do-install".


----------



## driesm (Feb 2, 2020)

What Elazar sais is correct. The default do-build and do-install targets assume a Makefile in ${WRKSRC}. You should overwrite do-install to copy the files from ${WRKSRC} to somewhere in ${STAGEDIR} with ${COPYTREE_SHARE}. The porters handbook can help a lot here, its very helpful! Also, you CAN NOT set both DISTVERSION and PORTVERSION, only set one of the two (preferably DISTVERSION).


----------



## SirDice (Feb 3, 2020)

Edited the thread to include the subject in the topic. So people know what's it about. Also moved thread to "Porting new software".


----------



## Deleted member (Feb 4, 2020)

Makefile

```
# $FreeBSD$

PORTNAME=    NetRexx
DISTVERSION=    3.08
CATEGORIES=    java
MASTER_SITES=    http://www.netrexx.org/files/
DISTFILES=    ${PORTNAME}-${DISTVERSION}-GA.zip

MAINTAINER=    ports@FreeBSD.org
COMMENT=    NetRexx is a general-purpose programming language inspired by two very different programming languages, Rexx and Java.

LICENSE=    ICU
LICENSE_FILE=    ${WRKSRC}/LICENSE
LICENSE_PERMS=    auto-accept
LICENSE_NAME=    LICENSE

NO_BUILD=    yes
USES=        zip
USE_JAVA=    yes
JAVA_VERSION=     1.8

NO_ARCH=    yes

OPTIONS_DEFINE=    DOCS EXAMPLES

pre-patch:
    for file in ${WRKSRC}/bin/NetRexxC.sh  \
${WRKSRC}/bin/nrc ${WRKSRC}/bin/pipc \
                    ${WRKSRC}/bin/pipe ${WRKSRC}/read.me.first; do \
${WRKSRC}/read.me.first; do \
        ${TR} -d '\015' < $${file} > $${file}.new; \
        ${MV} $${file}.new $${file}; \
    done

post-patch:
    ${REINPLACE_CMD} -e 's,%%JAVA_HOME%%,${JAVA_HOME},' \
                     -e 's,%%JAVAJARDIR%%,${JAVAJARDIR},' \
                     ${WRKSRC}/bin/NetRexxC.sh

do-install:
    ${INSTALL_SCRIPT} ${WRKSRC}/bin/NetRexxC.sh ${STAGEDIR}${PREFIX}/bin
    ${INSTALL_SCRIPT} ${WRKSRC}/bin/nrc ${STAGEDIR}${PREFIX}/bin
    ${INSTALL_SCRIPT} ${WRKSRC}/bin/pipc ${STAGEDIR}${PREFIX}/bin
    ${INSTALL_SCRIPT} ${WRKSRC}/bin/pipe ${STAGEDIR}${PREFIX}/bin
    ${INSTALL_DATA} ${WRKSRC}/lib/NetRexxC.jar ${STAGEDIR}${JAVAJARDIR}
    ${INSTALL_DATA} ${WRKSRC}/runlib/NetRexxR.jar ${STAGEDIR}${JAVAJARDIR}
    @${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
    ${INSTALL_DATA} ${WRKSRC}/bin/hello.nrx ${STAGEDIR}${EXAMPLESDIR}
    (cd ${WRKSRC}/examples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR})
    (cd ${WRKSRC}/documents && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR})

    @${ECHO} "====================  IBM LICENSE  ===================="
    @${CAT} ${WRKSRC}/LICENSE
    @${ECHO} "-------------------------------------------------------"
    @${ECHO} "====================  IMPORTANT!!  ===================="
    @${CAT} ${WRKSRC}/read.me.first

.include <bsd.port.mk>
```
distinfo

```
TIMESTAMP = 1580771811
SHA256 (NetRexx-3.08-GA.zip) = 216bc84172661a3c2576108dea9db7dd9a6163392ceb45dde58edcd98b17f821
SIZE (NetRexx-3.08-GA.zip) = 16214952
```
Okay, I went back and reworked the Makefile and `make makesum` generates the distinfo correctly.

However, when I try to generate the pkg-plist

```
===>  Missing license file for ICU in /usr/ports/java/netrexx/work/NetRexx-3.08/LICENSE
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/java/netrexx
*** Error code 1

Stop.
make: stopped in /usr/ports/java/netrexx
```

But the work subdirectory doesn't have the NetRexx-3.08, but I don't see where I'm setting that in the Makefile and everything is just in work itself

```
.extract_done.NetRexx._usr_local    lib
LICENSE                    read.me.first
META-INF                releasenotes.txt
bin                    runlib
documents                tools
examples
```

But if I create work/NetRexx-3.08/ and unzip the original zip files in there, then it works.


----------



## George (Feb 4, 2020)

I think it is common to put the source files in a folder (e.g. NetRexx-3.08), then zip that folder. Because that will be your ${WRKSRC}.

`make` searches the License file in ${WRKSRC}, because you specified "LICENSE_FILE=    ${WRKSRC}/LICENSE".

Default location for ${WRKSRC} is a folder named ${PORTNAME}-${DISTVERSION}, which in your case, should be work/NetRexx-3.08, right?


----------



## Deleted member (Feb 4, 2020)

Yes, work/NetRexx-3.08 should be the default location.  But I was under the impression it would automatically create work/NetRexx-3.08 and unzip the downloaded source to that location.  However, it seems to have downloaded and unzipped the source in work instead.

So the default location, in this case, work/NetRexx-3.08, has to be manually created and the source files have to be moved to that location by me, and it isn't automatically done?


----------



## SirDice (Feb 4, 2020)

Chapter 5. Configuring the Makefile
					

Configuring the Makefile for FreeBSD Ports




					www.freebsd.org


----------



## Deleted member (Feb 4, 2020)

Thanks to all of you.  I think I only have one question remaining, and that is how to set a file in the installation to 755?

I read in the handbook *8.6.13.3. @mode      mode*

But I'm still unclear, if I could get an example?


----------



## Deleted member (Feb 8, 2020)

```
Procedure 3.1. Recommended Test Ordering
[LIST=1]
[*]make stage
[*]make stage-qa
[*]make package
[*]make install
[*]make deinstall
[*]make package (as user)
```


All steps are successful.

Makefile

```
# $FreeBSD$

PORTNAME=    NetRexx
DISTVERSION=    3.08
CATEGORIES=    java
MASTER_SITES=    http://www.netrexx.org/files/
DISTNAME=    ${PORTNAME}-${DISTVERSION}
DISTFILES=    ${PORTNAME}-${DISTVERSION}-GA.zip
WRKSRC=        ${WRKDIR}/${DISTNAME}
NO_WRKSUBDIR=    yes

MAINTAINER=    ports@FreeBSD.org
COMMENT=   NetRexx is a general-purpose programming language inspired by two very different programming languages, Rexx and Java.

NO_BUILD=    yes
USES=        zip
USE_JAVA=    yes
JAVA_VERSION=     1.8

NO_ARCH=    yes

LICENSE=    ICU
LICENSE_FILE=    ${WRKSRC}/LICENSE
LICENSE_NAME=    ${WRKSRC}/LICENSE
LICENSE_PERMS=    pkg-mirror dist-mirror auto-accept

OPTIONS_DEFINE=    DOCS EXAMPLES


PLIST_FILES=    "@mode 755" \
                ${PORTNAME}-${DISTVERSION}/bin/NetRexxC.sh \
        ${PORTNAME}-${DISTVERSION}/bin/nrc \
        ${PORTNAME}-${DISTVERSION}/bin/pipc \
        ${PORTNAME}-${DISTVERSION}/bin/pipe \
        "@mode 644" \
        ${PORTNAME}-${DISTVERSION}/examples/hello.nrx \
        ${PORTNAME}-${DISTVERSION}/lib/NetRexxC.jar \
            ${PORTNAME}-${DISTVERSION}/runlib/NetRexxR.jar \
                ${PORTNAME}-${DISTVERSION}/documents/NetRexx\ 3.08-GA\ Language\ Reference.pdf \
        ${PORTNAME}-${DISTVERSION}/documents/NetRexx\ 3.08-GA\ Pipelines\ Quick\ Start\ Guide.pdf \
        ${PORTNAME}-${DISTVERSION}/documents/NetRexx\ 3.08-GA\ Programming\ Guide.pdf \
        ${PORTNAME}-${DISTVERSION}/documents/NetRexx\ 3.08-GA\ QuickStart\ Guide.pdf \
        ${PORTNAME}-${DISTVERSION}/documents/stages.pdf

pre-patch:
    for file in ${WRKSRC}/bin/NetRexxC.sh ${WRKSRC}/bin/nrc ${WRKSRC}/bin/pipc \
                    ${WRKSRC}/bin/pipe ${WRKSRC}/read.me.first; do \
        ${TR} -d '\015' < $${file} > $${file}.new; \
        ${MV} $${file}.new $${file}; \
    done

do-install:
    ${MKDIR} ${STAGEDIR}${PREFIX}/${PORTNAME}-${DISTVERSION}/bin
    ${MKDIR} ${STAGEDIR}${PREFIX}/${PORTNAME}-${DISTVERSION}/lib
    ${MKDIR} ${STAGEDIR}${PREFIX}/${PORTNAME}-${DISTVERSION}/runlib
    ${MKDIR} ${STAGEDIR}${PREFIX}/${PORTNAME}-${DISTVERSION}/examples
    ${MKDIR} ${STAGEDIR}${PREFIX}/${PORTNAME}-${DISTVERSION}/documents
    ${INSTALL_SCRIPT} ${WRKSRC}/bin/NetRexxC.sh ${STAGEDIR}${PREFIX}/${PORTNAME}-${DISTVERSION}/bin
    ${INSTALL_SCRIPT} ${WRKSRC}/bin/nrc ${STAGEDIR}${PREFIX}/${PORTNAME}-${DISTVERSION}/bin
    ${INSTALL_SCRIPT} ${WRKSRC}/bin/pipc ${STAGEDIR}${PREFIX}/${PORTNAME}-${DISTVERSION}/bin
    ${INSTALL_SCRIPT} ${WRKSRC}/bin/pipe ${STAGEDIR}${PREFIX}/${PORTNAME}-${DISTVERSION}/bin
    ${INSTALL_DATA} ${WRKSRC}/lib/NetRexxC.jar ${STAGEDIR}${PREFIX}/${PORTNAME}-${DISTVERSION}/lib
    ${INSTALL_DATA} ${WRKSRC}/runlib/NetRexxR.jar ${STAGEDIR}${PREFIX}/${PORTNAME}-${DISTVERSION}/runlib
    @${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
    ${INSTALL_DATA} ${WRKSRC}/bin/hello.nrx ${STAGEDIR}${PREFIX}/${PORTNAME}-${DISTVERSION}/examples
    (cd ${WRKSRC}/documents && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/${PORTNAME}-${DISTVERSION}/documents)

    @${ECHO} "====================  IBM LICENSE  ===================="
    @${CAT} ${WRKSRC}/LICENSE
    @${ECHO} "-------------------------------------------------------"
    @${ECHO} "====================  IMPORTANT!!  ===================="
    @${CAT} ${WRKSRC}/read.me.first

.include <bsd.port.mk>
```


`portlint` returns:

```
WARN: Makefile: use of DISTFILES with single file discouraged. distribution filename should be set by DISTNAME and EXTRACT_SUFX.
WARN: Makefile: "USES" has to appear earlier.
0 fatal errors and 2 warnings found.
```


```
Important: 
We do not need the work directory or     the pkgname.txz package, so delete them     now.
```
Does the pkg directory need to exist and just delete the txz file, or also remove the pkg directory?


----------

