Bug 146895 - [NEW PORT] emulators/linux-libusb: linux(4)-friendly libusb
Summary: [NEW PORT] emulators/linux-libusb: linux(4)-friendly libusb
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Juergen Lock
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2010-05-24 01:10 UTC by Wojciech A. Koszek
Modified: 2015-04-18 14:30 UTC (History)
0 users

See Also:


Attachments
file.shar (575 bytes, text/plain)
2010-05-24 01:10 UTC, Wojciech A. Koszek
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wojciech A. Koszek freebsd_committer freebsd_triage 2010-05-24 01:10:07 UTC
I fixed and compiled libusb(8) from FreeBSD on Linux. I modified kernel
so that it knows what libusb(8) in linux(4) will call, and maps ioctl()
calls to the correct functionality.

As a result, I can use Linux binaries that make use of LibUSB on linux(8).

thompsa@ is bringing amd64 changes on the top of my patch.
Support is to be commited soon.

This port needs following fixes:

- verify why making ln -s is broken. Seems like something is wrong with ports infrastructure, since other port (mentioned in Makefile) had the same problem as well. Unless I put "ln -f", I couldn't get a link to be created.

- pick the correct __FreeBSD_version, once kernel functionality is present

Fix: Patch attached with submission follows:
How-To-Repeat: 
Download:

	http://freebsd.czest.pl/~wkoszek/ports/linux-libusb-20100524.tar.gz

For tarball and:

	http://freebsd.czest.pl/~wkoszek/ports/linux-libusb.tgz

Port's sources.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2010-05-24 01:10:18 UTC
Responsible Changed
From-To: freebsd-ports-bugs->wkoszek

Submitter has GNATS access (via the GNATS Auto Assign Tool)
Comment 2 Wojciech A. Koszek freebsd_committer freebsd_triage 2010-05-24 01:12:20 UTC
Responsible Changed
From-To: wkoszek->freebsd-ports-bugs

I'm not a ports commiter.
Comment 3 Wojciech A. Koszek freebsd_committer freebsd_triage 2010-05-24 08:31:46 UTC
State Changed
From-To: open->feedback


Port has been updated to match kernel changes.
Comment 4 Max Brazhnikov freebsd_committer freebsd_triage 2010-06-18 08:46:19 UTC
Hi Wojciech,

> This port should be marked as "open". Getting it in the ports/ tree 
> before 8.1 freeze means we could announce Linuxolator-friendly libusb(8), 
> since my changes hit the tree before 8.1 src/ freeze.

is the port supposed to build on 8-stable now? if yes, please adjust OSVERSION 
check accordingly, I'll take the pr then.

Max
Comment 5 Max Brazhnikov freebsd_committer freebsd_triage 2010-06-22 20:46:51 UTC
State Changed
From-To: open->feedback

Wait for submitters response
Comment 6 Philip M. Gollucci freebsd_committer freebsd_triage 2010-09-16 20:26:28 UTC
State Changed
From-To: feedback->open

submitter feedback timeout: (wkoszek ; 86 days)
Comment 7 Tilman Keskinoz freebsd_committer freebsd_triage 2011-02-03 12:16:30 UTC
Responsible Changed
From-To: freebsd-ports-bugs->wkoszek

Over to submitter, 

Both URLs are 404
Comment 8 Tilman Keskinoz freebsd_committer freebsd_triage 2011-02-03 13:55:16 UTC
On 02/03/2011 01:40 PM, Mark Linimon wrote:
>> Synopsis: [NEW PORT] emulators/linux-libusb -- linux(4)-friendly libusb
>>
>> Responsible-Changed-From-To: freebsd-ports-bugs->wkoszek
>> Responsible-Changed-By: arved
>> Responsible-Changed-When: Thu Feb 3 12:16:30 UTC 2011
>> Responsible-Changed-Why:
>> Over to submitter,
>
> Well, he's not a ports committer, so needs someone else to commit it
> for him:
>

Sorry for the shortness.

Yes he can not commit, but he is the only person who knows where the 
actual patch is hiding after he reorganized his homepage.

So this is more some kind of feedback state.

Wojciech, can you please post new working links to the file?
Comment 9 Uffe Jakobsen 2011-08-10 22:01:39 UTC
 >
 > Wojciech, can you please post new working links to the file?
 >

FYI: Download links are working again:

http://freebsd.czest.pl/~wkoszek/ports/linux-libusb.tgz

http://freebsd.czest.pl/~wkoszek/ports/linux-libusb-20100524.tar.gz
Comment 10 dfilter service freebsd_committer freebsd_triage 2014-03-18 19:50:51 UTC
Author: nox
Date: Tue Mar 18 19:50:47 2014
New Revision: 348592
URL: http://svnweb.freebsd.org/changeset/ports/348592
QAT: https://qat.redports.org/buildarchive/r348592/

Log:
  Add new port devel/linux_libusb:
  
  linux-libusb takes advantage of FreeBSD libusb(8) library, which got
  prepared to work correctly within linux(4) emulation layer. It lets
  you to take Linux binary linked with libusb.so and use it on
  FreeBSD.
  
  Additional information: This port has been prepared under FreeBSD
  with kern.osreldate = 1000510. It relies on the fact the libusb(8)
  API seems to be stable and no changes have been made to internal API
  for a long time. If this assumption isn't true, port won't work.
  Please submit bug report to the port maintainter in that case.
  
  WWW: http://lists.freebsd.org/pipermail/freebsd-usb/2014-March/012854.html
  
  PR:		ports/146895 (older version)
  Submitted by:	wkoszek (PR), nox (self, this version)

Added:
  head/devel/linux_libusb/
  head/devel/linux_libusb/Makefile   (contents, props changed)
  head/devel/linux_libusb/distinfo   (contents, props changed)
  head/devel/linux_libusb/pkg-descr   (contents, props changed)
Modified:
  head/devel/Makefile

Modified: head/devel/Makefile
==============================================================================
--- head/devel/Makefile	Tue Mar 18 19:08:35 2014	(r348591)
+++ head/devel/Makefile	Tue Mar 18 19:50:47 2014	(r348592)
@@ -1163,6 +1163,7 @@
     SUBDIR += linux-f10-sdl12
     SUBDIR += linux-kmod-compat
     SUBDIR += linux_kdump
+    SUBDIR += linux_libusb
     SUBDIR += lion
     SUBDIR += llnextgen
     SUBDIR += llvm-devel

Added: head/devel/linux_libusb/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/linux_libusb/Makefile	Tue Mar 18 19:50:47 2014	(r348592)
@@ -0,0 +1,85 @@
+# Created by: nox@FreeBSD.org
+# $FreeBSD$
+
+PORTNAME=	linux_libusb
+PORTVERSION=	11.0r${FSVN_REV}
+PORTREVISION=	1
+CATEGORIES=	devel linux
+MASTER_SITES=	LOCAL/nox
+
+MAINTAINER=	emulation@FreeBSD.org
+COMMENT=	Linux-compatibility libusb
+
+#BUILD_DEPENDS=	${LINUXBASE}/usr/bin/gcc:${PORTSDIR}/emulators/linux_base-gentoo-stage3
+BUILD_DEPENDS=	${LINUXBASE}/usr/bin/gcc:${PORTSDIR}/devel/linux-f10-devtools
+
+USES=		tar:bzip2
+ONLY_FOR_ARCHS=	i386 amd64
+USE_LINUX_PREFIX=	yes
+PLIST_FILES=		usr/lib/libusb.so	\
+			usr/lib/libusb-0.1.so.4 \
+			"@exec ${LDCONFIG_CMD}" \
+			"@unexec ${LDCONFIG_CMD}"
+CC=		${LINUXBASE}/usr/bin/gcc
+CFLAGS+=	-I${WRKDIR}/sys
+MAKE_ARGS+=	LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h
+MAKE_ARGS+=	PTHREAD_LIBS="-lpthread -lrt"
+# XXX ${LINUXBASE}/usr/bin/ld is a broken link with gentoo atm?
+#MAKE_ENV+=	COMPILER_PATH=/usr/i486-pc-linux-gnu/binutils-bin/2.22
+
+# see: sysutils/pc-sysinstall/Makefile
+FSVN_REV=	261448
+FSVNPATH?=	http://svn.freebsd.org/base/head
+FSVNDIR=	lib/libusb
+
+.include <bsd.port.pre.mk>
+
+.if ${ARCH} == "amd64"
+MAKE_ARGS+=	COMPAT_32BIT=YES
+.endif
+
+pre-everything::
+	@${ECHO_MSG} '===> Using the FreeBSD source tree under ${SRC_BASE}'
+	@${ECHO_MSG} '===> Set SRC_BASE to use an alternate source tree'
+
+.if ${OSVERSION} < 1000000
+IGNORE= doesn't build on < 10.x
+.endif
+.if !exists(${SRC_BASE}/sys/i386/linux/syscalls.master)
+IGNORE=	requires kernel source present in ${SRC_BASE}/sys
+.endif
+#.if !exists(${SRC_BASE}/lib/libusb/Makefile)
+#IGNORE=	requires libusb source present in ${SRC_BASE}/lib/libusb
+#.endif
+#.if exists(${LINUXBASE}/etc/fedora-release)
+#IGNORE=	does not build with the default linux base, use the package instead
+#.endif
+
+post-patch:
+	${MKDIR} ${WRKDIR}/sys
+	${LN} -s ${SRC_BASE}/sys/compat ${SRC_BASE}/sys/dev ${WRKDIR}/sys
+
+# XXX: Due to problems with ports/ infrastructure, we don't seem to be able
+# to symlink files. I provide hardlink instead. If fixed, remember to remove
+# link name from PLIST_FILES.
+do-install:
+	${MKDIR} ${STAGEDIR}${PREFIX}/usr/lib
+	${INSTALL_DATA} ${WRKSRC}/libusb.so ${STAGEDIR}${PREFIX}/usr/lib
+# Xilinx ISE requirement.
+	${LN} -f ${STAGEDIR}${PREFIX}/usr/lib/libusb.so ${STAGEDIR}${PREFIX}/usr/lib/libusb-0.1.so.4
+
+.if defined(BOOTSTRAP) || defined(SVN_FETCH)
+#FETCH_DEPENDS+=		svn:${PORTSDIR}/devel/subversion
+SVN?=		svnlite
+
+do-fetch:
+	${MKDIR} ${WRKDIR}
+	${SVN} export -r ${FSVN_REV} ${FSVNPATH}/${FSVNDIR} ${WRKDIR}/${DISTNAME}
+	cd ${WRKDIR}; tar cvfy ${DISTDIR}/${DISTNAME}.tar.bz2 ${DISTNAME}
+.if ${USER} == noxNOTYET
+	scp ${DISTDIR}/${DISTNAME}.tar.bz2 \
+	    nox@freefall.freebsd.org:public_distfiles/
+.endif
+.endif
+
+.include <bsd.port.post.mk>

Added: head/devel/linux_libusb/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/linux_libusb/distinfo	Tue Mar 18 19:50:47 2014	(r348592)
@@ -0,0 +1,2 @@
+SHA256 (linux_libusb-11.0r261448.tar.bz2) = e1013ccd0181e00a55bb786be54d125b71462492442122350d820b98fef97f81
+SIZE (linux_libusb-11.0r261448.tar.bz2) = 45739

Added: head/devel/linux_libusb/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/linux_libusb/pkg-descr	Tue Mar 18 19:50:47 2014	(r348592)
@@ -0,0 +1,12 @@
+linux-libusb takes advantage of FreeBSD libusb(8) library, which got
+prepared to work correctly within linux(4) emulation layer. It lets
+you to take Linux binary linked with libusb.so and use it on
+FreeBSD.
+
+Additional information: This port has been prepared under FreeBSD
+with kern.osreldate = 1000510. It relies on the fact the libusb(8)
+API seems to be stable and no changes have been made to internal API
+for a long time. If this assumption isn't true, port won't work.
+Please submit bug report to the port maintainter in that case.
+
+WWW: http://lists.freebsd.org/pipermail/freebsd-usb/2014-March/012854.html
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 11 Wojciech A. Koszek freebsd_committer freebsd_triage 2014-06-01 07:18:47 UTC
State Changed
From-To: feedback->open

I changed it to "feedback" by accident.  

This port should be marked as "open". Getting it in the ports/ tree 
before 8.1 freeze means we could announce Linuxolator-friendly libusb(8), 
since my changes hit the tree before 8.1 src/ freeze.
Comment 12 Mark Linimon freebsd_committer freebsd_triage 2015-03-10 03:11:54 UTC
Release to wild.
Comment 13 Kubilay Kocak freebsd_committer freebsd_triage 2015-04-18 14:30:56 UTC
Committed by nox@ in r348592

[1] http://svnweb.freebsd.org/ports?view=revision&revision=348592