ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

ReactOS Community > ReactOS Wiki

Using code from other projects

From ReactOS

Jump to: navigation, search

We use a lot of code from other, GPL compatible, projects. This page describes how to import code like that into our SVN repository and how to keep it up to date. I'll be using a Wine DLL (msimg32.dll) as an example, but the process is the same for other projects.

Initial import

It's best to start from a released version of the other projects code, not from bleeding-edge CVS. This will make keeping the external code up to date easier later on. For my example, I start with

 cvs -d :pserver:cvs@cvs.winehq.com:2401/home/wine export -r Wine-20041201 wine/dlls/msimg32

This will check out the Wine-20041201 release of msimg32.

Using the "export" command instead of "co" automatically avoids the CVS subdirectories. You only have to remove the .cvsignore files, since we're using SVN we don't need the those.

Then import the files into our vendor tree: (note the "current" at the end of the SVN URL)

 svn import wine/dlls/msimg32 svn://svn.reactos.org/reactos/vendor/wine/dlls/msimg32/current 

Tag the files with their Wine release number:

  svn copy svn://svn.reactos.org/reactos/vendor/wine/dlls/msimg32/current svn://svn.reactos.org/reactos/vendor/wine/dlls/msimg32/Wine-20041201

Next, copy the files from the vendor tree to the trunk:

 svn copy svn://svn.reactos.org/reactos/vendor/wine/dlls/msimg32/current svn://svn.reactos.org/reactos/trunk/reactos/lib/msimg32

Go to your reactos\lib directory and issue the command

 svn update

This will create a working copy of the vendor files in reactos\lib\msimg32. Make any changes needed to this working copy to get it to compile and run on ReactOS. At minimum, you'll need to add a Makefile and a Makefile.ros-template. Both can be copied from e.g. reactos\lib\cabinet. You shouldn't have to make any changes to the Makefile, but some edits in Makefile.ros-template are necessary. For msimg32, I needed to change TARGET_NAME, TARGET_SDKLIBS, TARGET_BASE and the RC entries. Add ReactOS-only files to svn: "svn add Makefile Makefile.ros-template".

You need to set some svn properties. Easiest way to do this is first a "make clean" in the msimg32 directory, then

  svn propset -R svn:eol-style native *  

You also need to set the ignore property on the directory.

 svn propset svn:ignore GNUmakefile .

Commit your changes:

 svn commit

To wrap things up, add the new library to reactos\media\doc\README.WINE, so it will be kept in sync. Add the lib to reactos\Makefile and reactos\bootdata\packages\reactos.dff to get it compiled and installed in the default build.

Importing a new release

Instructions are mostly useful on Linux

Once you have imported a vendor drop and a new version of the package is released, you of course want ReactOS to use that new version too. The first thing is to download the new release from the vendor and unpack it if needed.

Then you need to checkout a working copy of the current vendor drop in the svn repository:

 svn checkout svn://svn.reactos.org/reactos/vendor/Mesa3D/current

Now you have to update the working copy with the new release by copying all files from the vendor package into the 'current' working copy. Since you have to keep the .svn directories an easy way to do this is to change into the 'current' directory and run the following command:

 tar cvf /tmp/svndirs `find . -type d -name .svn`

This will save all .svn directories in a file named /tmp/svndirs. Now you can remove the contents of the 'current' directory, copy the contents from the new release into it and restore the .svn directories, i.e.:

 rm -rf current/*
 mv Mesa-6.4/* current
 cd current
 tar xvf /tmp/svndirs

You should do "svn status" to check for added or deleted files:

 svn status

This will give you a list of all files in the 'current' directory and their status. The ones which you gotta look for are '?' (which means it's a new file) and '!' (which means that it got deleted)

Then "svn add" the new files and "svn delete" the removed files, here's the easy way to do it:

 svn add `svn status | awk '$1 == "?" { print $2; }'`
 svn delete `svn status | awk '$1 == "!" { print $2; }'` 

Do "svn status" again and make sure everything is ok (you should get only A, D or M status) Once you are sure that everything is ok don't forget to set the svn:eol-style:

 svn propset -R svn:eol-style native *

Finally you can commit the new version:

 svn commit

And tag it with the release number:

 svn copy svn://svn.reactos.org/reactos/vendor/Mesa3D/current svn://svn.reactos.org/reactos/vendor/Mesa3D/Mesa-6.4

Merging changes from a new release

With the new version of a package imported as 'current' the changes from the old version to the current can be merged by changing into the reactos working copy and doing "svn merge":

 cd reactos/lib/mesa32
 svn merge svn://svn.reactos.org/reactos/vendor/Mesa3D/Mesa-6.2 svn://svn.reactos.org/reactos/vendor/Mesa3D/current

This will merge the changes from Mesa3D/Mesa-6.2 to Mesa3D/current into the current working directory (reactos/lib/mesa32) Now you have to fix any conflicts from the merge (a 'C' is printed in front of a filename by svn to indicate conflicts), apply ReactOS specific changes needed to get the new version compiling/working and then commit the new version.

 svn commit

Note: When you get an error saying that a file which is to be committed comes from a different repository make sure you use the same URL for the "svn merge" command as you used to checkout your working copy (use "svn info" to display the url of your working copy)

After you have sucessfully committed the changes the old version of the package can be deleted:

 svn delete svn://svn.reactos.org/reactos/vendor/Mesa3D/Mesa-6.2