Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Troubles with making ebuild for Yuescript
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
alecStewart1
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jul 2022
Posts: 148

PostPosted: Wed Aug 28, 2024 2:02 am    Post subject: Troubles with making ebuild for Yuescript Reply with quote

Hello friends, I thought I'd try my hand at making an ebuild for Yuescript: https://yuescript.org/

I have the following:

Code:

# Copyright 2020-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

MY_V="v${PV}"

LUA_COMPAT=( lua5-{1..4} luajit )

inherit toolchain-funcs lua-single

DESCRIPTION="Yuescript is a dynamic language that compiles to Lua. And it's a
Moonscript dialect."
HOMEPAGE="https://yuescript.org/ https://github.com/pigpigyyy/Yuescript"
SRC_URI="https://github.com/pigpigyyy/Yuescript/archive/refs/tags/${MY_V}.tar.gz"
S="${WORKDIR}/${MY_V}"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+system-lua +macros"
REQUIRED_USE="${LUA_REQUIRED_USE}"

BDEPEND="
        virtual/pkgconfig
        system-lua? ( ${LUA_DEPS} )
"

pkg_setup() {
        use system-lua && lua-single_pkg_setup
}

src_configure() {
        tc-export CXX LUA_EXEC_NAME="${ELUA}" NO_LUA=$(usex system-lua) NO_MACROS=$(usex macros)
}

src_compile() {
        emake
}

src_install() {
        emake install
}


Thing is, I keep getting

Code:

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) dev-lang/yuescript-0.24.1::local-repo
 * v0.24.1.tar.gz BLAKE2B SHA512 size ;-) ...                                                                                                                                                                                                                                                                            [ ok ]
 * Using luajit to build
>>> Unpacking source...
>>> Unpacking v0.24.1.tar.gz to /var/tmp/portage/portage/dev-lang/yuescript-0.24.1/work
>>> Source unpacked in /var/tmp/portage/portage/dev-lang/yuescript-0.24.1/work
 * ERROR: dev-lang/yuescript-0.24.1::local-repo failed (prepare phase):
 *   The source directory '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/work/v0.24.1' doesn't exist
 *
 * Call stack:
 *            ebuild.sh, line  784:  Called __ebuild_main 'prepare'
 *   phase-functions.sh, line 1073:  Called __dyn_prepare
 *   phase-functions.sh, line  400:  Called die
 * The specific snippet of code:
 *              die "The source directory '${S}' doesn't exist"
 *
 * If you need support, post the output of `emerge --info '=dev-lang/yuescript-0.24.1::local-repo'`,
 * the complete build log and the output of `emerge -pqv '=dev-lang/yuescript-0.24.1::local-repo'`.
 * The complete build log is located at '/var/log/portage/dev-lang:yuescript-0.24.1:20240828-020036.log'.
 * For convenience, a symlink to the build log is located at '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/temp/environment'.
 * Working directory: '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/empty'
 * S: '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/work/v0.24.1'

>>> Failed to emerge dev-lang/yuescript-0.24.1, Log file:

>>>  '/var/log/portage/dev-lang:yuescript-0.24.1:20240828-020036.log'

 * Messages for package dev-lang/yuescript-0.24.1:
 * Log file: /var/log/portage/dev-lang:yuescript-0.24.1:20240828-020036.log

 * ERROR: dev-lang/yuescript-0.24.1::local-repo failed (prepare phase):
 *   The source directory '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/work/v0.24.1' doesn't exist
 *
 * Call stack:
 *            ebuild.sh, line  784:  Called __ebuild_main 'prepare'
 *   phase-functions.sh, line 1073:  Called __dyn_prepare
 *   phase-functions.sh, line  400:  Called die
 * The specific snippet of code:
 *              die "The source directory '${S}' doesn't exist"
 *
 * If you need support, post the output of `emerge --info '=dev-lang/yuescript-0.24.1::local-repo'`,
 * the complete build log and the output of `emerge -pqv '=dev-lang/yuescript-0.24.1::local-repo'`.
 * The complete build log is located at '/var/log/portage/dev-lang:yuescript-0.24.1:20240828-020036.log'.
 * For convenience, a symlink to the build log is located at '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/temp/environment'.
 * Working directory: '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/empty'
 * S: '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/work/v0.24.1'


And I'm really unclear and so how to resolve this. If you're going to suggest that S instead be

Code:

S="${WORKDIR}/${PN}/${MY_V}"


That doesn't work either.


Last edited by alecStewart1 on Sat Sep 07, 2024 10:37 pm; edited 1 time in total
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 31257
Location: here

PostPosted: Wed Aug 28, 2024 5:53 am    Post subject: Reply with quote

Try to change line
Code:
SRC_URI="https://github.com/pigpigyyy/Yuescript/archive/refs/tags/${MY_V}.tar.gz"

to
Code:
SRC_URI="https://github.com/pigpigyyy/Yuescript/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"

and comment lines MY_V="v${PV}" and S="${WORKDIR}/${MY_V}".
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
alecStewart1
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jul 2022
Posts: 148

PostPosted: Tue Sep 03, 2024 3:54 am    Post subject: Reply with quote

fedeliallalinea wrote:
Try to change line
Code:
SRC_URI="https://github.com/pigpigyyy/Yuescript/archive/refs/tags/${MY_V}.tar.gz"

to
Code:
SRC_URI="https://github.com/pigpigyyy/Yuescript/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"

and comment lines MY_V="v${PV}" and S="${WORKDIR}/${MY_V}".


Ah, I forgot about the arrow. That makes sense, however, running ebuild yuescript-0.24.1.ebuild manifest will try to grab distfiles?

Code:

>>> Downloading 'https://mirror.csclub.uwaterloo.ca/gentoo-distfiles/distfiles/25/yuescript-0.24.1.tar.gz'
--2024-09-02 22:53:34--  https://mirror.csclub.uwaterloo.ca/gentoo-distfiles/distfiles/25/yuescript-0.24.1.tar.gz
Resolving mirror.csclub.uwaterloo.ca... 129.97.134.71
Connecting to mirror.csclub.uwaterloo.ca|129.97.134.71|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2024-09-02 22:53:34 ERROR 404: Not Found.

>>> Downloading 'https://ftp.uni-hannover.de/gentoo/distfiles/layout.conf'
--2024-09-02 22:53:35--  https://ftp.uni-hannover.de/gentoo/distfiles/layout.conf
Resolving ftp.uni-hannover.de... 130.75.2.22
Connecting to ftp.uni-hannover.de|130.75.2.22|:443...
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 31257
Location: here

PostPosted: Tue Sep 03, 2024 6:06 am    Post subject: Reply with quote

You can add line RESTRICT="mirror" this force portage to fetch only from SRC_URI.
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
alecStewart1
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jul 2022
Posts: 148

PostPosted: Wed Sep 04, 2024 2:46 am    Post subject: Reply with quote

fedeliallalinea wrote:
You can add line RESTRICT="mirror" this force portage to fetch only from SRC_URI.


Awesome, thank you! Now we're getting into the bits where I may be a bit stupid.

So I'm trying to get yuescript to properly build against, in this case, luajit. For some reason, even with an environment variables set like LUA_EXEC_NAME="${ELUA}", yuescript will be built like the following

Code:

>>> Compiling source in /var/tmp/portage/portage/dev-lang/yuescript-0.24.1/work/Yuescript-0.24.1 ...
/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/temp/environment: line 1593: !use: command not found
make -j12 LUA_EXEC_NAME=luajit NO_LUA=yes NO_MACROS=
Creating directories
Beginning release build
make[1]: Entering directory '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/work/Yuescript-0.24.1/src/3rdParty/lua'
make all SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl"
make[2]: Entering directory '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/work/Yuescript-0.24.1/src/3rdParty/lua'
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lapi.o lapi.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX   -c lcode.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lctype.o lctype.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o ldebug.o ldebug.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o ldo.o ldo.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o ldump.o ldump.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lfunc.o lfunc.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lgc.o lgc.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX   -c llex.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lmem.o lmem.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lobject.o lobject.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lopcodes.o lopcodes.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX   -c lparser.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lstate.o lstate.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lstring.o lstring.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o ltable.o ltable.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o ltm.o ltm.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lundump.o lundump.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lvm.o lvm.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lzio.o lzio.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lauxlib.o lauxlib.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lbaselib.o lbaselib.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lcorolib.o lcorolib.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o ldblib.o ldblib.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o liolib.o liolib.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lmathlib.o lmathlib.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o loadlib.o loadlib.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o loslib.o loslib.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lstrlib.o lstrlib.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o ltablib.o ltablib.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o lutf8lib.o lutf8lib.c
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_3 -DLUA_USE_LINUX    -c -o linit.o linit.c


This contains none of my CFLAGS, but I'm guessing that's my fault.

My other questions would be

How do I get -DLUA_COMPAT_5_3 to correspond to the user specified version?

How do I negate a use or use/usex statement?

Code:

# Copyright 2020-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

LUA_COMPAT=( lua5-{1..4} luajit )

inherit toolchain-funcs lua-single

DESCRIPTION="Yuescript is a dynamic language that compiles to Lua. And it's a Moonscript dialect."
HOMEPAGE="https://yuescript.org/ https://github.com/pigpigyyy/Yuescript"
SRC_URI="https://github.com/pigpigyyy/Yuescript/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
RESTRICT="mirror"

D="${PORTAGE_BUILDDIR}/bin/release"
S="${WORKDIR}/Yuescript-${PV}"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+system-lua +macros"
REQUIRED_USE="${LUA_REQUIRED_USE}"

BDEPEND="
        virtual/pkgconfig
        system-lua? ( ${LUA_DEPS} )
"

pkg_setup() {
        use system-lua && lua-single_pkg_setup
}

src_configure() {
        tc-export CXX
}

src_compile() {
        emake LUA_EXEC_NAME="${ELUA}" NO_LUA=$(usex system-lua) NO_MACROS=$(!use macros)
}

src_install() {
        emake DESTDIR="$D" LUA_EXEC_NAME="${ELUA}" NO_LUA=$(usex system-lua) NO_MACROS=$(! use macros) install
}


The other thing is making sure that the resulting executable in ${PORTAGE_BUILDDIR}/bin/release/ is linked to /usr/local/bin

Code:

Beginning release build
make[1]: Entering directory '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/work/Yuescript-0.24.1/src/3rdParty/lua'
make all SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl"
make[2]: Entering directory '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/work/Yuescript-0.24.1/src/3rdParty/lua'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/work/Yuescript-0.24.1/src/3rdParty/lua'
make[1]: Leaving directory '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/work/Yuescript-0.24.1/src/3rdParty/lua'
Making symlink: yue -> bin/release/yue
Total build time: 00:00:00
Installing to /var/tmp/portage/portage/dev-lang/yuescript-0.24.1/imageusr/local/bin
/usr/bin/install: cannot create regular file '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/imageusr/local/bin': No such file or directory
install-xattr: failed to stat /var/tmp/portage/portage/dev-lang/yuescript-0.24.1/imageusr/local/bin: No such file or directory


Maybe a few of these questions are worth asking the maintainers of yuescript, but I thought I'd ask them here first.
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2401

PostPosted: Wed Sep 04, 2024 4:14 am    Post subject: Reply with quote

Not related to your questions, but did you notice this:

alecStewart1 wrote:

Code:

>>> Compiling source in /var/tmp/portage/portage/dev-lang/yuescript-0.24.1/work/Yuescript-0.24.1 ...
/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/temp/environment: line 1593: !use: command not found


alecStewart1 wrote:
The other thing is making sure that the resulting executable in ${PORTAGE_BUILDDIR}/bin/release/ is linked to /usr/local/bin


That location is intended for things an administrator puts on the system like scripts et.c.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22618

PostPosted: Wed Sep 04, 2024 12:43 pm    Post subject: Reply with quote

logrusx wrote:
Not related to your questions, but did you notice this:
alecStewart1 wrote:
Code:
>>> Compiling source in /var/tmp/portage/portage/dev-lang/yuescript-0.24.1/work/Yuescript-0.24.1 ...
/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/temp/environment: line 1593: !use: command not found
I think that is what led to this question:
alecStewart1 wrote:
How do I negate a use or use/usex statement?
alecStewart1 wrote:
For some reason, even with an environment variables set like LUA_EXEC_NAME="${ELUA}", yuescript will be built like the following
As an initial frame challenge, why do you think setting that variable should do anything? Does upstream's build system use that variable in a useful way? It looks to me like you set the variable properly, and Make should have passed it to the programs it ran.
Code:
$ printf 'a:\n\t/usr/bin/env\n' | /usr/bin/env -i /usr/bin/make -f - LUA_EXEC_NAME=luajit
/usr/bin/env
MAKEFLAGS= -- LUA_EXEC_NAME=luajit
MFLAGS=
MAKELEVEL=1
LUA_EXEC_NAME=luajit
Therefore, my first suspicion would be that upstream either overrides this variable or ignores it entirely.
alecStewart1 wrote:
Code:
/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/temp/environment: line 1593: !use: command not found
Since you are not doing this in an if test, you will need to approach this differently. Per man 5 ebuild, I think you want:
Code:
NO_MACROS=$(usex macros no yes)
This says that if USE=macros, echo no. If USE=-macros, echo yes. Yes, this is confusing, and no, no one should use double negations like this.
alecStewart1 wrote:
This contains none of my CFLAGS, but I'm guessing that's my fault.
Maybe. As with LUA_EXEC_NAME, it could be that the upstream Makefile is either overriding the value or is ignoring it entirely.
Code:
$ printf 'CFLAGS=from-makefile\na:\n\t/usr/bin/env\n' | /usr/bin/env -i CFLAGS=from-environment /usr/bin/make -f -
/usr/bin/env
MAKEFLAGS=
MFLAGS=
MAKELEVEL=1
CFLAGS=from-makefile
alecStewart1 wrote:
How do I get -DLUA_COMPAT_5_3 to correspond to the user specified version?
You mean, how do you determine that 5 and 3 are the right numbers, given the value(s) the user picked for LUA_TARGETS?
alecStewart1 wrote:
Code:
D="${PORTAGE_BUILDDIR}/bin/release"
I think you should not set this here. Why is it here?
alecStewart1 wrote:
Code:
src_install() {
        emake DESTDIR="$D" LUA_EXEC_NAME="${ELUA}" NO_LUA=$(usex system-lua) NO_MACROS=$(! use macros) install
}
Code:
Installing to /var/tmp/portage/portage/dev-lang/yuescript-0.24.1/imageusr/local/bin
/usr/bin/install: cannot create regular file '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/imageusr/local/bin': No such file or directory
install-xattr: failed to stat /var/tmp/portage/portage/dev-lang/yuescript-0.24.1/imageusr/local/bin: No such file or directory
Your src_install looks correct, but this output is clearly wrong. I think upstream's install target is missing a /. You might be able to work around it by writing DESTDIR="$D/", but this is non-standard, so future readers would wonder why you have a trailing /.
alecStewart1 wrote:
The other thing is making sure that the resulting executable in ${PORTAGE_BUILDDIR}/bin/release/ is linked to /usr/local/bin
As logrusx said, it should go in /usr/bin. You may need another override, or a Makefile patch, to make that happen.
Back to top
View user's profile Send private message
alecStewart1
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jul 2022
Posts: 148

PostPosted: Wed Sep 04, 2024 3:42 pm    Post subject: Reply with quote

Hu wrote:

alecStewart1 wrote:
For some reason, even with an environment variables set like LUA_EXEC_NAME="${ELUA}", yuescript will be built like the following

As an initial frame challenge, why do you think setting that variable should do anything?
Does upstream's build system use that variable in a useful way? It looks to me like you set the variable properly, and Make should have passed it to the programs it ran.
Code:

$ printf 'a:\n\t/usr/bin/env\n' | /usr/bin/env -i /usr/bin/make -f - LUA_EXEC_NAME=luajit
/usr/bin/env
MAKEFLAGS= -- LUA_EXEC_NAME=luajit
MFLAGS=
MAKELEVEL=1
LUA_EXEC_NAME=luajit

Therefore, my first suspicion would be that upstream either overrides this variable or ignores it entirely.


Initially I thought you could do this to get yuescript to build against luajit. However it seems like, from this issue on the project, one has to do it another way.

Hu wrote:

alecStewart1 wrote:

Code:
/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/temp/environment: line 1593: !use: command not found

Since you are not doing this in an if test, you will need to approach this differently.
Per man 5 ebuild, I think you want:
Code:
NO_MACROS=$(usex macros no yes)

This says that if USE=macros, echo no. If USE=-macros, echo yes. Yes, this is confusing, and no, no one should use double negations like this.


So if it's confusing, is there not a better way to do this?

Hu wrote:

alecStewart1 wrote:
This contains none of my CFLAGS, but I'm guessing that's my fault.

Maybe. As with LUA_EXEC_NAME, it could be that the upstream Makefile is either overriding the value or is ignoring it entirely.
Code:
$ printf 'CFLAGS=from-makefile\na:\n\t/usr/bin/env\n' | /usr/bin/env -i CFLAGS=from-environment /usr/bin/make -f -
/usr/bin/env
MAKEFLAGS=
MFLAGS=
MAKELEVEL=1
CFLAGS=from-makefile



Makes sense. Well...it kind of doesn't make sense the Makefile is overriding or ignoring the values of CFLAGS/CXXFLAGS, but it makes sense as to that being the issue.

Hu wrote:

alecStewart1 wrote:

How do I get -DLUA_COMPAT_5_3 to correspond to the user specified version?

You mean, how do you determine that 5 and 3 are the right numbers, given the value(s) the user picked for LUA_TARGETS?


Yes, exactly.

Hu wrote:

alecStewart1 wrote:

Code:
D="${PORTAGE_BUILDDIR}/bin/release"

I think you should not set this here. Why is it here?


I thought setting D would install the resulting binary to the correct path. Not sure why I thought that.

Hu wrote:

alecStewart1 wrote:

Code:
src_install() {
        emake DESTDIR="$D" LUA_EXEC_NAME="${ELUA}" NO_LUA=$(usex system-lua) NO_MACROS=$(! use macros) install
}

Code:
Installing to /var/tmp/portage/portage/dev-lang/yuescript-0.24.1/imageusr/local/bin
/usr/bin/install: cannot create regular file '/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/imageusr/local/bin': No such file or directory
install-xattr: failed to stat /var/tmp/portage/portage/dev-lang/yuescript-0.24.1/imageusr/local/bin: No such file or directory


Your src_install looks correct, but this output is clearly wrong. I think upstream's install target is missing a /. You might be able to work around it by writing DESTDIR="$D/", but this is non-standard, so future readers would wonder why you have a trailing /.


Hmm, okay.

Hu wrote:

alecStewart1 wrote:
The other thing is making sure that the resulting executable in ${PORTAGE_BUILDDIR}/bin/release/ is linked to /usr/local/bin


As logrusx said, it should go in /usr/bin. You may need another override, or a Makefile patch, to make that happen.


Ah, of course. Part of me was hoping this ebuild wouldn't potentially involve patches or a ton of envvar override logic, but seems it's unavoidable.
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1910

PostPosted: Wed Sep 04, 2024 4:39 pm    Post subject: Reply with quote

alecStewart1 wrote:
Hu wrote:
alecStewart1 wrote:

Code:
/var/tmp/portage/portage/dev-lang/yuescript-0.24.1/temp/environment: line 1593: !use: command not found

Since you are not doing this in an if test, you will need to approach this differently.
Per man 5 ebuild, I think you want:
Code:
NO_MACROS=$(usex macros no yes)

This says that if USE=macros, echo no. If USE=-macros, echo yes. Yes, this is confusing, and no, no one should use double negations like this.


So if it's confusing, is there not a better way to do this?

I would suggest using $(usex macros '' NO_MACRO=true) as an example. The makefile specifically looks for a value of 'true'. When macros USE is enabled, it won't output anything.
Back to top
View user's profile Send private message
alecStewart1
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jul 2022
Posts: 148

PostPosted: Thu Sep 05, 2024 7:23 pm    Post subject: Reply with quote

Okay, a little peak into the project's makefile and I found these:

Code:

#### PROJECT SETTINGS ####
# The name of the executable to be created
BIN_NAME := yue
# Compiler used
CXX ?= g++
# Extension of source files used in the project
SRC_EXT = cpp
# Path to the source directory, relative to the makefile
SRC_PATH = ./src
# Space-separated pkg-config libraries used by this project
LIBS =
# General compiler flags
COMPILE_FLAGS = -std=c++17 -Wall -Wextra -Wno-deprecated-declarations
# Additional release-specific flags
RCOMPILE_FLAGS = -D NDEBUG -O3
# Additional debug-specific flags
DCOMPILE_FLAGS = -D DEBUG
# Add additional include paths
INCLUDES = -I $(SRC_PATH) -I $(SRC_PATH)/3rdParty
# General linker settings
LINK_FLAGS = -lpthread
# Additional release-specific linker settings
RLINK_FLAGS =
# Additional debug-specific linker settings
DLINK_FLAGS =
# Destination directory, like a jail or mounted system
DESTDIR = /
# Install path (bin/ is appended automatically)
INSTALL_PREFIX = usr/local


But, later on in the makefile, there's the following

Code:

release: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RCOMPILE_FLAGS)
release: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(RLINK_FLAGS)
debug: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(DCOMPILE_FLAGS)
debug: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(DLINK_FLAGS)
shared: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RCOMPILE_FLAGS) $(TARGET_FLAGS)


So, to me, it looks like I should do
Code:

tc-export CXX CXXFLAGS LDFLAGS


In the src_configure.
Back to top
View user's profile Send private message
alecStewart1
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jul 2022
Posts: 148

PostPosted: Thu Sep 05, 2024 7:28 pm    Post subject: Reply with quote

As a point to you, Hu, I found this in the project's CMakeLists.txt

Code:

get_filename_component(LUA_EXEC_NAME ${LUA} NAME)
if (LUA_EXEC_NAME STREQUAL "luajit")
   find_library(LUA_LIBRARIES
      NAMES luajit libluajit
      PATHS ${LUA_LIBDIR}
      NO_DEFAULT_PATH)
elseif (LUA_EXEC_NAME MATCHES "lua5\.4" OR LUA_EXEC_NAME MATCHES "lua54")
   find_library(LUA_LIBRARIES
      NAMES lua54 lua5.4 liblua54 liblua5.4 lua liblua
      PATHS ${LUA_LIBDIR}
      NO_DEFAULT_PATH)
elseif (LUA_EXEC_NAME MATCHES "lua5\.3" OR LUA_EXEC_NAME MATCHES "lua53")
   find_library(LUA_LIBRARIES
      NAMES lua53 lua5.3 liblua53 liblua5.3 lua liblua
      PATHS ${LUA_LIBDIR}
      NO_DEFAULT_PATH)
elseif (LUA_EXEC_NAME MATCHES "lua5\.2" OR LUA_EXEC_NAME MATCHES "lua52")
   find_library(LUA_LIBRARIES
      NAMES lua52 lua5.2 liblua52 liblua5.2 lua liblua
      PATHS ${LUA_LIBDIR}
      NO_DEFAULT_PATH)
elseif (LUA_EXEC_NAME MATCHES "lua5\.1" OR LUA_EXEC_NAME MATCHES "lua51")
   find_library(LUA_LIBRARIES
      NAMES lua51 lua5.1 liblua51 liblua5.1 lua liblua
      PATHS ${LUA_LIBDIR}
      NO_DEFAULT_PATH)
else ()
   find_library(LUA_LIBRARIES
      NAMES lua liblua
      PATHS ${LUA_LIBDIR}
      NO_DEFAULT_PATH)
endif()
Back to top
View user's profile Send private message
alecStewart1
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jul 2022
Posts: 148

PostPosted: Sat Sep 07, 2024 10:36 pm    Post subject: Reply with quote

Alright, until I get some feedback from someone working on the project, I'm considering this a lost cause. I thought I could be cheeky by patching the makefile to directly use the users CXXFLAGS and LDFLAGS, but it just...doesn't.

Code:

--- a/makefile  2024-09-07 17:00:35.518312030 -0500
+++ b/makefile  2024-09-07 17:25:49.606947110 -0500
@@ -10,29 +10,29 @@
 # Space-separated pkg-config libraries used by this project
 LIBS =
 # General compiler flags
-COMPILE_FLAGS = -std=c++17 -Wall -Wextra -Wno-deprecated-declarations
+COMPILE_FLAGS = -std=c++17 -Wextra -Wno-deprecated-declarations ${CXXFLAGS}
 # Additional release-specific flags
-RCOMPILE_FLAGS = -D NDEBUG -O3
+#RCOMPILE_FLAGS = -D NDEBUG -O3
 # Additional debug-specific flags
-DCOMPILE_FLAGS = -D DEBUG
+DCOMPILE_FLAGS = -D DEBUG ${CXXFLAGS}
 # Add additional include paths
 INCLUDES = -I $(SRC_PATH) -I $(SRC_PATH)/3rdParty
 # General linker settings
-LINK_FLAGS = -lpthread
+LINK_FLAGS = ${LDFLAGS} -lpthread
 # Additional release-specific linker settings
-RLINK_FLAGS =
+#RLINK_FLAGS =
 # Additional debug-specific linker settings
 DLINK_FLAGS =
 # Destination directory, like a jail or mounted system
 DESTDIR = /
 # Install path (bin/ is appended automatically)
-INSTALL_PREFIX = usr/local
+INSTALL_PREFIX = usr/
 # Test
 TEST_INPUT = ./spec/inputs
 TEST_OUTPUT = ./spec/generated
 GEN_OUTPUT = ./spec/outputs

-PLAT = macos
+PLAT = linux

 #### END PROJECT SETTINGS ####

@@ -95,11 +95,11 @@
 endif

 # Combine compiler and linker flags
-release: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RCOMPILE_FLAGS)
-release: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(RLINK_FLAGS)
-debug: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(DCOMPILE_FLAGS)
-debug: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(DLINK_FLAGS)
-shared: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RCOMPILE_FLAGS) $(TARGET_FLAGS)
+release: export CXXFLAGS := $(COMPILE_FLAGS)
+release: export LDFLAGS := $(LINK_FLAGS)
+debug: export CXXFLAGS := $(COMPILE_FLAGS) $(DCOMPILE_FLAGS)
+debug: export LDFLAGS := $(LINK_FLAGS) $(DLINK_FLAGS)
+shared: export CXXFLAGS := $(COMPILE_FLAGS) $(TARGET_FLAGS)

 # Build and output paths
 release: export BUILD_PATH := build/release


At this point, I think I'm just not even going to bother. I thought this would be vastly simpler, but it appears to not be.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum