Ask Your Question
0

Modifying packages/libraries source code

asked 2020-08-25 10:17:09 -0600

anonymous user

Anonymous

I was looking at the source of one of the libraries (libbraiding) that Sage uses and was interested in making a few small changes and testing the result.

I have no experience with compiling/packaging such code; I was wondering whether it is easy to download the source of the Sage package, make a couple of minor changes to it and then force Sage to install/compile it? If yes, can someone please point me in the right direction?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2020-08-25 11:45:02 -0600

mmarco gravatar image

Hi

I am the maintainer of libbraiding. If the changes you want to make are relevant, you can try to make a pull request with them and I might merge them and release a new version.

If you just want to try some things in your machine, maybe the simplest way is to compile libbraiding with your changes with the usual cycle:

autoreconf --install
./configure
make

and then use the generated files in the lib/.libs directory to replace the corresponding ones in the /local/lib/ directroy of your sage installation.

edit flag offensive delete link more

Comments

If the changes you make also affect the interface of the library (that is, the name or parameters of the exposed functions), you might need to also replace the corresponding header file in the local/include directory of your sage install, and then modify the file src/sage/libs/braiding.pyxand rebuild the sage library with sage -b

mmarco gravatar imagemmarco ( 2020-08-25 11:57:42 -0600 )edit
0

answered 2020-08-25 11:57:22 -0600

tmonteil gravatar image

libbraidingis a C++ library that you can fetch at https://github.com/miguelmarco/libbra... so you need to know some C++ to be able to modify it.

Let me assume that you installed Sage from source (see the doc), and suggest the following easy "hacky" way.

You can see the tarball of the library as SAGE_ROOT/upstream/libbraiding-1.0.tar.gz where SAGE_ROOT is the directory where you installed Sage.

You can unpack that archive somewhere (with the command tar xvf libbraiding-1.0.tar.gz that creates a libbraiding-1.0 directory with all the source code) and start modify the code. Once you are happy, you can repack a tarball with another version : tar czvf libbraiding-2.0.tar.gz DIRECTORY where DIRECTORY is the unpacked and modified directory (it is currently named libbraiding-1.0).

Now you can put this alternative archive back into the SAGE_ROOT/upstream directory, it has the name libbraiding-2.0.tar.gz.

You should tell Sage to use that 2.0 version by modifying the file SAGE_ROOT/build/pkgs/libbraiding/package-version.txt and replace 1.0.p0 with 2.0.

Now, you have to tell Sage to recompute the hashsums of the tarball, by running the command sage --package fix-checksum. This will update the file SAGE_ROOT/build/pkgs/libbraiding/checksums.ini

Now, you can rebuild the package with the command: sage -f libbraiding

I let you guess how to go back to version 1.0p0 once you are done.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-08-25 10:17:09 -0600

Seen: 98 times

Last updated: Aug 25