# Is there any problem with this port?



## bkouhi (Feb 20, 2013)

Hello forum,

Here is Makefile:


```
# $FreeBSD$

PORTNAME=       logisim
PORTVERSION=    2.7.1
CATEGORIES=     cad java
MASTER_SITES=   SF/circuit/2.7.x/2.7.1/
DISTNAME=       ${PORTNAME}-generic-${PORTVERSION}.jar
[color="Red"]EXTRACT_SUFX=[/color]
EXTRACT_ONLY=

MAINTAINER=     javad.kouhi@gmail.com
COMMENT=        An educational tool for designing and simulating logic circuits

LICENSE=        GPLv2

NO_BUILD=       yes
USE_JAVA=       yes
JAVA_RUN=       yes
JAVA_VERSION=   1.6+
[color="red"]DATADIR=        ${PREFIX}/share/${PORTNAME}
PLIST_FILES=    %%DATADIR%%/${DISTNAME} \
                bin/logisim
PLIST_DIRS=     %%DATADIR%%[/color]

do-install:
        ${MKDIR} ${DATADIR}
        ${INSTALL_DATA} ${DISTDIR}/${DISTNAME} ${DATADIR}
        [color="red"]${ECHO_CMD} -e "#!/bin/sh\n${JAVA} -jar ${PREFIX}/share/${UNIQUENAME}/${DISTNAME}" > ${PREFIX}/bin/logisim
        ${CHMOD} a+rx ${PREFIX}/bin/logisim[/color]

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

Although it works for me but I'm not sure about installation path and do-install section. Does ports allowed to create files with ${ECHO_CMD} under file system? Is there any problem with red lines?


----------



## cpm@ (Feb 20, 2013)

Read master file /usr/ports/Mk/bsd.port.mk for help you debug Makefile.

`# less -p ECHO_CMD /usr/ports/Mk/bsd.port.mk`


----------



## bkouhi (Feb 20, 2013)

Thanks, so this variables is only for debugging and must not be used in Makefile. But is there a way to install a file in ${PREFIX}/bin with the following content?


```
#!/bin/sh
${JAVA} -jar ${PREFIX}/share/file.jar
```

Obviously, variables must be substituted before creation of file. Please note that the original distfile does not contain this file and I have to create it manually.


----------



## bkouhi (Feb 21, 2013)

Ok, I changed it a bit. Do you see any problem?


```
# $FreeBSD$

PORTNAME=       logisim
PORTVERSION=    2.7.1
CATEGORIES=     cad java
MASTER_SITES=   SF/circuit/2.7.x/2.7.1/
DISTNAME=       ${PORTNAME}-generic-${PORTVERSION}
EXTRACT_SUFX=   .jar
EXTRACT_ONLY=

MAINTAINER=     javad.kouhi@gmail.com
COMMENT=        An educational tool for designing and simulating logic circuits

LICENSE=        GPLv2

NO_BUILD=       yes
USE_JAVA=       yes
JAVA_RUN=       yes
JAVA_VERSION=   1.6+
DATADIR=        ${PREFIX}/share/${UNIQUENAME}
PLIST_FILES=    %%DATADIR%%/logisim-generic-2.7.1.jar \
                bin/logisim
PLIST_DIRS=     %%DATADIR%%

do-extract:
        ${MKDIR} ${WRKSRC}
        ${CP} ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX} ${WRKSRC}
        ${ECHO_CMD} -e "#!/bin/sh\nexec ${JAVA} -jar ${DATADIR}/${DISTNAME}${EXTRACT_SUFX}" > ${WRKSRC}/${PORTNAME}

do-install:
        ${MKDIR} ${DATADIR}
        ${INSTALL_DATA} ${WRKSRC}/${DISTNAME}${EXTRACT_SUFX} ${DATADIR}
        ${INSTALL_SCRIPT} ${WRKSRC}/${PORTNAME} ${PREFIX}/bin/

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

Please test it and report problems to me.

Thank you!


----------



## wblock@ (Feb 21, 2013)

Why are you setting EXTRACT_ONLY to nothing rather than just leaving it out?  The use of %%DATADIR%% looks weird.  Where is that being substituted with the real thing?  And the version number in PLIST_FILES should use ${PORTVERSION} instead of a hard-coded value.

Run portlint(1) from ports-mgmt/portlint on it.


----------



## bkouhi (Feb 21, 2013)

Many thanks wblock@.
If I change %%DATADIR%% to ${DATADIR} in PLIST_DIRS, I'll get this error message:


```
# make deinstall
===>  Deinstalling for cad/logisim
===>   Deinstalling logisim-2.7.1
pkg_delete: file '/usr/local//usr/local/share/logisim' doesn't exist
pkg_delete: unable to completely remove directory '/usr/local//usr/local/share/logisim'
pkg_delete: couldn't entirely delete package `logisim-2.7.1'
(perhaps the packing list is incorrectly specified?)
#
```

But to avoid hard coding, I changed this lines:


```
PLIST_FILES=    %%DATADIR%%/${PORTNAME}-generic-${PORTVERSION}${EXTRACT_SUFX} \
                bin/logisim
PLIST_DIRS=     %%DATADIR%%
```

For EXTRACT_ONLY, please see handbook.

Also portlint say "looks fine".


----------



## Michael-Sanders (Feb 22, 2013)

Hello bkouhi.

It appears you have embedded doubled forward-slashes '*//*'


```
pkg_delete: file '/usr/local[B][color="Red"][SIZE="2"]//[/SIZE][/color][/B]usr/local/share/logisim' doesn't exist

...

PLIST_FILES=    %%DATADIR%%[color="Red"][B][SIZE="2"]/[/SIZE][/B][/color]${PORTNAME}-generic-${PORTVERSION}${EXTRACT_SUFX} \
                bin/logisim
```

But...later you seem to preserve it?


----------



## bkouhi (Feb 22, 2013)

Thank you Michael!

I fixed it:


```
PLIST_FILES=    share/${UNIQUENAME}/${PORTNAME}-generic-${PORTVERSION}${EXTRACT_SUFX} \
                bin/${PORTNAME}
PLIST_DIRS=     %%DATADIR%%
```

I think this is better  But that error message is related to this line (I've corrected it too):


```
PLIST_DIRS=     ${DATADIR}
```

Must be:

```
PLIST_DIRS=     %%DATADIR%%
```


----------



## Michael-Sanders (Feb 22, 2013)

Glad you've fixed it & no need to thank me, just noting the anomaly ('%%' preserves the string). Good luck & best wishes with your port bkouhi. =)


----------

