Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dailo

macrumors regular
Original poster
Mar 29, 2006
154
0
I really like to use Xcode to program but I am making KLD modules for FreeBSD and it's a pain always uploading an updated file to my FreeBSD server and compiling it. Is there anyway I can have it automatically upload the updated source code to my FreeBSD server so I don't have to do it manually everytime. i tried cyberduck's synchronization thing, but it doesn't appear to be doing it automatically when I save with Xcode. Thanks!
 

superbovine

macrumors 68030
Nov 7, 2003
2,872
0
dailo said:
I really like to use Xcode to program but I am making KLD modules for FreeBSD and it's a pain always uploading an updated file to my FreeBSD server and compiling it. Is there anyway I can have it automatically upload the updated source code to my FreeBSD server so I don't have to do it manually everytime. i tried cyberduck's synchronization thing, but it doesn't appear to be doing it automatically when I save with Xcode. Thanks!

Use SCM to work with xcode. if you need more help, i'd suggest you google for it. there is a lot resources on this topic.

http://heath.hrsoftworks.net/archives/000026.html
http://maczealots.com/tutorials/xcode-cvs/
http://developer.apple.com/internet/opensource/cvsoverview.html

I'd suggest you have the CVS server installed on your bsd box, it can be on your mac. After you update your repository just make a CVS account for your bsd box to update it source code before compiling. You can do all this in your make file or use a different script entirely. Generally, I have two scripts one to update and clean and one to make. One of the things you will have to catch is it will update the *.o files, and you will have to clean them once you update your CVS account on your bsd box.
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
You "should" be able to program it in applescript with a folder action, I'm not exactly sure how to program it but it should work, alternatively you could do an applescript that runs when idle, and checks the directory for items modified after it last ran, then upload to your server.
 

superbovine

macrumors 68030
Nov 7, 2003
2,872
0
Eraserhead said:
You "should" be able to program it in applescript with a folder action, I'm not exactly sure how to program it but it should work, alternatively you could do an applescript that runs when idle, and checks the directory for items modified after it last ran, then upload to your server.

CVS does exactly what you said in the first part. however, it logs and revision numbers and all kinds of usually things for you to keep your revision straight and code sharing between multiple coders.
 

dailo

macrumors regular
Original poster
Mar 29, 2006
154
0
Wow CVS, never really looked into this before. Seems pretty frickin awesome haha. Keeps all my revisions, thansk a lot!! I am a student programmer and this seems like it will help a lot. Thanks.
 

dailo

macrumors regular
Original poster
Mar 29, 2006
154
0
How do I add a command in my makefile to automatically update the source before compiling it? I cannot seem to find anything on it on google. Thanks.

superbovine said:
Use SCM to work with xcode. if you need more help, i'd suggest you google for it. there is a lot resources on this topic.

http://heath.hrsoftworks.net/archives/000026.html
http://maczealots.com/tutorials/xcode-cvs/
http://developer.apple.com/internet/opensource/cvsoverview.html

I'd suggest you have the CVS server installed on your bsd box, it can be on your mac. After you update your repository just make a CVS account for your bsd box to update it source code before compiling. You can all this to your make file or use a different script entirely. Generally, I have two scripts one to update and clean and one to make. One of the things you will have to catch is it will update the *.o files, and you will have to clean them once you update your CVS account on your bsd box.
 

superbovine

macrumors 68030
Nov 7, 2003
2,872
0
dailo said:
How do I add a command in my makefile to automatically update the source before compiling it? I cannot seem to find anything on it on google. Thanks.

After you learn this stuff pretty well, CVS looks great on a resume.

This is a partial script which you should be able to modify your own makefile to work with this. I use two different scripts, this is part of my update cvs script.

The script basically calls a cvs update then backups the old source code in a backup directory giving you another layer of revisions. after that it overwrites the old source with the updated source from the cvs.


Code:
#!/bin/sh

cat << EOF
This script will make a backup of the ~/prod/src directory, and then replace
~/dev/src with a snapshot of the CVS using ~/cvsstuff/Crimson local copy
(which will be updated).

Press return to continue, Ctrl-C to quit out.
EOF
read dummy

echo "Updating the cvs local copy at ~/cvsstuff/c2src/src/"
cd ~/cvsstuff/c2src/src/
cvs update
echo "Done."

echo "Moving current source/bin directory to src_`date "+%b_%d_%Y"`."
cd ~/dev
mv src src_`date "+%b_%d_%Y"`
mkdir src
echo "Done."

echo "Copying new src snapshot."
cd src
cp ~/cvsstuff/c2src/src/*.[ch] .
cp ~/cvsstuff/c2src/src/makefile .
cp ~/cvsstuff/c2src/src/depend .
echo "Done."

If this code is confusing you, read up on some shell scripting. google knows all about shell scripting. here is a link to get you started.

http://www.noendpress.com/vroman/shellscripting/index.php
 

dailo

macrumors regular
Original poster
Mar 29, 2006
154
0
Thanks a lot! I started to write my own script, but yours is much better.

Also this CVS stuff is pretty awesome. I've always heard of it, but never took the time to look into it. But seems very useful, especially for big projects.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.